diff options
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/checks.nix | 13 | ||||
| -rw-r--r-- | dev/ci.nix | 35 | ||||
| -rw-r--r-- | dev/default.nix | 11 | ||||
| -rw-r--r-- | dev/shell.nix | 32 |
4 files changed, 91 insertions, 0 deletions
diff --git a/dev/checks.nix b/dev/checks.nix new file mode 100644 index 0000000..386e122 --- /dev/null +++ b/dev/checks.nix @@ -0,0 +1,13 @@ +{ + perSystem = {config, ...}: { + pre-commit = { + settings.hooks = { + actionlint.enable = true; + ${config.formatter.pname}.enable = true; + deadnix.enable = true; + nil.enable = true; + statix.enable = true; + }; + }; + }; +} diff --git a/dev/ci.nix b/dev/ci.nix new file mode 100644 index 0000000..1eb78e3 --- /dev/null +++ b/dev/ci.nix @@ -0,0 +1,35 @@ +{ + lib, + self, + ... +}: { + nix2workflow.output = self.hydraJobs; + + flake.hydraJobs = let + ciSystems = ["x86_64-linux" "x86_64-darwin"]; + recursiveMerge = builtins.foldl' lib.recursiveUpdate {}; + in + recursiveMerge [ + (let + outputs = lib.getAttrs ["checks" "devShells"] self; + isCompatible = system: _: lib.elem system ciSystems; + in + lib.mapAttrs (_: lib.filterAttrs isCompatible) outputs) + + ( + let + configurations = + lib.getAttrs [ + "nixosConfigurations" + "darwinConfigurations" + "homeConfigurations" + ] + self; + + isCompatible = _: configuration: lib.elem configuration.pkgs.system ciSystems; + toDeriv = _: configuration: configuration.config.system.build.toplevel or configuration.activationPackage; + in + lib.mapAttrs (_: v: lib.mapAttrs toDeriv (lib.filterAttrs isCompatible v)) configurations + ) + ]; +} diff --git a/dev/default.nix b/dev/default.nix new file mode 100644 index 0000000..d8da3fe --- /dev/null +++ b/dev/default.nix @@ -0,0 +1,11 @@ +{ + imports = [ + ./checks.nix + ./ci.nix + ./shell.nix + ]; + + perSystem = {pkgs, ...}: { + formatter = pkgs.alejandra; + }; +} diff --git a/dev/shell.nix b/dev/shell.nix new file mode 100644 index 0000000..c0c9d20 --- /dev/null +++ b/dev/shell.nix @@ -0,0 +1,32 @@ +{ + perSystem = { + pkgs, + config, + inputs', + ... + }: { + devShells = { + default = pkgs.mkShell { + shellHook = config.pre-commit.installationScript; + packages = with pkgs; + [ + actionlint + + # nix + config.formatter + deadnix + nil + statix + + # utils + deploy-rs + fzf + just + jq + opentofu + ] + ++ lib.optional stdenv.isLinux inputs'.agenix.packages.agenix; + }; + }; + }; +} |
