diff options
Diffstat (limited to 'modules/flake')
| -rw-r--r-- | modules/flake/ci.nix | 56 | ||||
| -rw-r--r-- | modules/flake/default.nix | 13 | ||||
| -rw-r--r-- | modules/flake/dev.nix | 47 |
3 files changed, 116 insertions, 0 deletions
diff --git a/modules/flake/ci.nix b/modules/flake/ci.nix new file mode 100644 index 0000000..91dc397 --- /dev/null +++ b/modules/flake/ci.nix @@ -0,0 +1,56 @@ +{ + self, + inputs, + ... +}: let + inherit (inputs) hercules-ci-effects nixpkgs; +in { + imports = [ + hercules-ci-effects.flakeModule + ]; + + hercules-ci = { + flake-update = { + enable = true; + when = { + hour = [0]; + minute = 0; + }; + }; + }; + + herculesCI = let + inherit + (import + (hercules-ci-effects + "/vendor/hercules-ci-agent/default-herculesCI-for-flake.nix")) + flakeToOutputs + ; + in rec { + ciSystems = [ + "x86_64-linux" + "aarch64-linux" + ]; + + onPush = { + default = { + outputs = with builtins; + with nixpkgs.lib; let + # use defaults, but only evaluate hosts + defaults = + removeAttrs + (flakeToOutputs self { + ciSystems = genAttrs ciSystems (_: {}); + }) + ["nixosConfigurations" "packages"]; + + evaluate = mapAttrs (_: v: + seq + v.config.system.build.toplevel + v._module.args.pkgs.emptyFile) + self.nixosConfigurations; + in + mkForce (defaults // evaluate); + }; + }; + }; +} diff --git a/modules/flake/default.nix b/modules/flake/default.nix new file mode 100644 index 0000000..29c6c63 --- /dev/null +++ b/modules/flake/default.nix @@ -0,0 +1,13 @@ +_: { + imports = [ + ./ci.nix + ./dev.nix + ]; + + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; +} diff --git a/modules/flake/dev.nix b/modules/flake/dev.nix new file mode 100644 index 0000000..712f334 --- /dev/null +++ b/modules/flake/dev.nix @@ -0,0 +1,47 @@ +{ + self, + inputs, + ... +}: let + inherit (inputs) nil pre-commit-hooks ragenix; +in { + perSystem = { + pkgs, + system, + ... + }: { + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./..; + hooks = { + actionlint.enable = true; + alejandra.enable = true; + deadnix.enable = true; + nil.enable = true; + statix.enable = true; + stylua.enable = true; + }; + }; + }; + + devShells = let + inherit (pkgs) mkShell; + in { + default = mkShell { + inherit (self.checks.${system}.pre-commit-check) shellHook; + packages = with pkgs; [ + actionlint + alejandra + deadnix + just + nil.packages.${system}.nil + ragenix.packages.${system}.ragenix + statix + stylua + ]; + }; + }; + + formatter = pkgs.alejandra; + }; +} |
