From be286a453d1902af09431f28a5a02a8c00a954ea Mon Sep 17 00:00:00 2001 From: seth Date: Fri, 5 Jul 2024 07:01:21 -0400 Subject: tree-wide: move dev outputs to dev/ --- checks.nix | 42 ------------------------------------------ dev/checks.nix | 42 ++++++++++++++++++++++++++++++++++++++++++ dev/default.nix | 13 +++++++++++++ dev/devShells.nix | 38 ++++++++++++++++++++++++++++++++++++++ dev/hydraJobs.nix | 26 ++++++++++++++++++++++++++ devShells.nix | 38 -------------------------------------- flake.nix | 15 ++------------- hydraJobs.nix | 26 -------------------------- 8 files changed, 121 insertions(+), 119 deletions(-) delete mode 100644 checks.nix create mode 100644 dev/checks.nix create mode 100644 dev/default.nix create mode 100644 dev/devShells.nix create mode 100644 dev/hydraJobs.nix delete mode 100644 devShells.nix delete mode 100644 hydraJobs.nix diff --git a/checks.nix b/checks.nix deleted file mode 100644 index 56c5038..0000000 --- a/checks.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - 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/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; + }; + } + ); +} diff --git a/devShells.nix b/devShells.nix deleted file mode 100644 index 9bed89b..0000000 --- a/devShells.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - 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/flake.nix b/flake.nix index 547b020..0982525 100644 --- a/flake.nix +++ b/flake.nix @@ -18,25 +18,14 @@ imports = [ # primary outputs + ./dev ./lib ./modules ./systems ./users - # dev outputs - ./checks.nix - ./devShells.nix - ./hydraJobs.nix - - # external, not so nix-y things - ./ext + ./ext # external, not so nix-y things ]; - - perSystem = - { pkgs, ... }: - { - formatter = pkgs.nixfmt-rfc-style; - }; }; inputs = { diff --git a/hydraJobs.nix b/hydraJobs.nix deleted file mode 100644 index 9cc4617..0000000 --- a/hydraJobs.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - 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; - }; - } - ); -} -- cgit v1.2.3