diff options
| -rw-r--r-- | flake.nix | 71 | ||||
| -rw-r--r-- | repo/checks.nix | 13 | ||||
| -rw-r--r-- | repo/ci.nix | 29 | ||||
| -rw-r--r-- | repo/default.nix | 11 | ||||
| -rw-r--r-- | repo/shell.nix | 34 |
5 files changed, 68 insertions, 90 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"; diff --git a/repo/checks.nix b/repo/checks.nix deleted file mode 100644 index cf2b732..0000000 --- a/repo/checks.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - perSystem = {self', ...}: { - pre-commit = { - settings.hooks = { - actionlint.enable = true; - ${self'.formatter.pname}.enable = true; - deadnix.enable = true; - nil.enable = true; - statix.enable = true; - }; - }; - }; -} diff --git a/repo/ci.nix b/repo/ci.nix deleted file mode 100644 index 05fd106..0000000 --- a/repo/ci.nix +++ /dev/null @@ -1,29 +0,0 @@ -{self, ...}: { - perSystem = { - lib, - pkgs, - system, - self', - ... - }: 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 { - packages.ciGate = pkgs.writeText "ci-gate" ( - lib.concatMapStringsSep "\n" toString required - ); - }; -} diff --git a/repo/default.nix b/repo/default.nix deleted file mode 100644 index d8da3fe..0000000 --- a/repo/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - imports = [ - ./checks.nix - ./ci.nix - ./shell.nix - ]; - - perSystem = {pkgs, ...}: { - formatter = pkgs.alejandra; - }; -} diff --git a/repo/shell.nix b/repo/shell.nix deleted file mode 100644 index 7442907..0000000 --- a/repo/shell.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ - perSystem = { - pkgs, - config, - inputs', - self', - ... - }: { - 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]; - }; - }; - }; -} |
