diff options
Diffstat (limited to 'repo')
| -rw-r--r-- | repo/checks.nix | 13 | ||||
| -rw-r--r-- | repo/ci.nix | 28 | ||||
| -rw-r--r-- | repo/default.nix | 11 | ||||
| -rw-r--r-- | repo/shell.nix | 34 |
4 files changed, 86 insertions, 0 deletions
diff --git a/repo/checks.nix b/repo/checks.nix new file mode 100644 index 0000000..cf2b732 --- /dev/null +++ b/repo/checks.nix @@ -0,0 +1,13 @@ +{ + 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 new file mode 100644 index 0000000..e33c088 --- /dev/null +++ b/repo/ci.nix @@ -0,0 +1,28 @@ +{ + lib, + self, + ... +}: { + flake.hydraJobs = let + ciSystems = ["x86_64-linux"]; + + getOutputs = lib.getAttrs ciSystems; + + mapCfgsToDerivs = lib.mapAttrs (_: cfg: cfg.activationPackage or cfg.config.system.build.toplevel); + getCompatibleCfgs = lib.filterAttrs (_: cfg: lib.elem cfg.pkgs.system ciSystems); + in + builtins.foldl' lib.recursiveUpdate {} [ + ( + lib.genAttrs + ["nixosConfigurations" "homeConfigurations"] + ( + type: mapCfgsToDerivs (getCompatibleCfgs self."${type}") + ) + ) + ( + lib.genAttrs + ["checks" "devShells"] + (type: getOutputs self.${type}) + ) + ]; +} diff --git a/repo/default.nix b/repo/default.nix new file mode 100644 index 0000000..d8da3fe --- /dev/null +++ b/repo/default.nix @@ -0,0 +1,11 @@ +{ + imports = [ + ./checks.nix + ./ci.nix + ./shell.nix + ]; + + perSystem = {pkgs, ...}: { + formatter = pkgs.alejandra; + }; +} diff --git a/repo/shell.nix b/repo/shell.nix new file mode 100644 index 0000000..7442907 --- /dev/null +++ b/repo/shell.nix @@ -0,0 +1,34 @@ +{ + 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]; + }; + }; + }; +} |
