diff options
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/checks.nix | 42 | ||||
| -rw-r--r-- | dev/default.nix | 13 | ||||
| -rw-r--r-- | dev/devShells.nix | 38 | ||||
| -rw-r--r-- | dev/hydraJobs.nix | 26 |
4 files changed, 119 insertions, 0 deletions
diff --git a/dev/checks.nix b/dev/checks.nix new file mode 100644 index 0000000..56c5038 --- /dev/null +++ b/dev/checks.nix @@ -0,0 +1,42 @@ +{ + perSystem = + { pkgs, ... }: + { + checks = { + check-formatting = + pkgs.runCommand "check-formatting" { nativeBuildInputs = [ pkgs.nixfmt-rfc-style ]; } + '' + cd ${./.} + + echo "running nixfmt..." + nixfmt --check . + + touch $out + ''; + + check-lint = + pkgs.runCommand "check-lint" + { + nativeBuildInputs = [ + pkgs.actionlint + pkgs.deadnix + pkgs.statix + ]; + } + '' + cd ${./.} + + echo "running actionlint..." + actionlint ./.github/workflows/* + + echo "running deadnix..." + deadnix --fail + + echo "running statix..." + statix check . + + touch $out + ''; + }; + }; +} diff --git a/dev/default.nix b/dev/default.nix new file mode 100644 index 0000000..105273c --- /dev/null +++ b/dev/default.nix @@ -0,0 +1,13 @@ +{ + imports = [ + ./checks.nix + ./devShells.nix + ./hydraJobs.nix + ]; + + perSystem = + { pkgs, ... }: + { + formatter = pkgs.nixfmt-rfc-style; + }; +} diff --git a/dev/devShells.nix b/dev/devShells.nix new file mode 100644 index 0000000..9bed89b --- /dev/null +++ b/dev/devShells.nix @@ -0,0 +1,38 @@ +{ + perSystem = + { + lib, + pkgs, + inputs', + self', + ... + }: + { + devShells = { + default = pkgs.mkShellNoCC { + packages = + [ + pkgs.lix + + # format + lint + pkgs.actionlint + self'.formatter + pkgs.deadnix + pkgs.nil + pkgs.statix + + # utils + pkgs.deploy-rs + pkgs.fzf + pkgs.just + self'.packages.opentofu + ] + ++ lib.optional pkgs.stdenv.isDarwin [ inputs'.nix-darwin.packages.darwin-rebuild ] + ++ lib.optionals pkgs.stdenv.isLinux [ + pkgs.nixos-rebuild + inputs'.agenix.packages.agenix + ]; + }; + }; + }; +} diff --git a/dev/hydraJobs.nix b/dev/hydraJobs.nix new file mode 100644 index 0000000..9cc4617 --- /dev/null +++ b/dev/hydraJobs.nix @@ -0,0 +1,26 @@ +{ + lib, + self, + withSystem, + ... +}: +let + ciSystem = "x86_64-linux"; + derivFromCfg = deriv: deriv.config.system.build.toplevel or deriv.activationPackage; + mapCfgsToDerivs = lib.mapAttrs (lib.const derivFromCfg); +in +{ + flake.hydraJobs = withSystem ciSystem ( + { pkgs, self', ... }: + { + inherit (self') checks; + inherit (self') devShells; + darwinConfigurations = mapCfgsToDerivs self.darwinConfigurations; + homeConfigurations = mapCfgsToDerivs self.homeConfigurations; + nixosConfigurations = mapCfgsToDerivs self.nixosConfigurations // { + # please add aarch64 runners github...please... + atlas = lib.deepSeq (derivFromCfg self.nixosConfigurations.atlas).drvPath pkgs.emptyFile; + }; + } + ); +} |
