diff options
| author | seth <[email protected]> | 2024-02-28 06:50:30 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2024-02-28 06:50:30 -0500 |
| commit | 62621080f9f97f5dffa889daf1dbc7257ba2cda7 (patch) | |
| tree | 2d43ba122f05a722d25d15274492e666f514756b /flake.nix | |
| parent | c8ce9e7c75b65176a1e018d37948a72e55e8d4d1 (diff) | |
move repo stuff to root flake.nix
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 71 |
1 files changed, 68 insertions, 3 deletions
@@ -9,7 +9,7 @@ outputs = inputs: let flakeModules = import ./modules/flake; in - inputs.flake-parts.lib.mkFlake {inherit inputs;} { + inputs.flake-parts.lib.mkFlake {inherit inputs;} ({self, ...}: { imports = [ ./lib ./modules @@ -17,7 +17,6 @@ ./systems ./users - ./repo # checks, ci, devShells, etc. ./ext # nix expressions for *external*, not so nix-y things inputs.pre-commit.flakeModule @@ -33,7 +32,73 @@ "x86_64-darwin" "aarch64-darwin" ]; - }; + + perSystem = { + config, + lib, + pkgs, + system, + inputs', + self', + ... + }: { + pre-commit = { + settings.hooks = { + actionlint.enable = true; + ${self'.formatter.pname}.enable = true; + deadnix.enable = true; + nil.enable = true; + statix.enable = true; + }; + }; + + devShells.default = pkgs.mkShellNoCC { + shellHook = config.pre-commit.installationScript; + packages = with pkgs; + [ + nix + + # format + lint + actionlint + self'.formatter + deadnix + nil + statix + + # utils + deploy-rs + fzf + just + config.terranix.package + ] + ++ lib.optional stdenv.isDarwin [inputs'.darwin.packages.darwin-rebuild] + ++ lib.optionals stdenv.isLinux [nixos-rebuild inputs'.agenix.packages.agenix]; + }; + + formatter = pkgs.alejandra; + + packages.ciGate = let + ci = self.lib.ci [system]; + + configurations = map (type: ci.mapCfgsToDerivs (ci.getCompatibleCfgs self.${type})) [ + "nixosConfigurations" + "darwinConfigurations" + "homeConfigurations" + ]; + + required = lib.concatMap lib.attrValues ( + [ + self'.checks + self'.devShells + ] + ++ configurations + ); + in + pkgs.writeText "ci-gate" ( + lib.concatMapStringsSep "\n" toString required + ); + }; + }); inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; |
