diff options
| -rw-r--r-- | checks/actionlint/package.nix | 2 | ||||
| -rw-r--r-- | checks/alejandra/package.nix | 2 | ||||
| -rw-r--r-- | checks/biome-fmt/package.nix | 2 | ||||
| -rw-r--r-- | checks/biome-lint/package.nix | 2 | ||||
| -rw-r--r-- | checks/deadnix/package.nix | 2 | ||||
| -rw-r--r-- | checks/editorconfig/package.nix | 2 | ||||
| -rw-r--r-- | checks/nixfmt/package.nix | 2 | ||||
| -rw-r--r-- | checks/prettier/package.nix | 2 | ||||
| -rw-r--r-- | checks/rustfmt/package.nix | 17 | ||||
| -rw-r--r-- | checks/selene/package.nix | 2 | ||||
| -rw-r--r-- | checks/statix/package.nix | 2 | ||||
| -rw-r--r-- | checks/stylua/package.nix | 2 | ||||
| -rw-r--r-- | default.nix | 8 | ||||
| -rw-r--r-- | template/flake.nix | 43 | ||||
| -rw-r--r-- | test/flake.nix | 31 |
15 files changed, 66 insertions, 55 deletions
diff --git a/checks/actionlint/package.nix b/checks/actionlint/package.nix index 561f826..83bd90e 100644 --- a/checks/actionlint/package.nix +++ b/checks/actionlint/package.nix @@ -4,7 +4,7 @@ root, actionlint, }: -runCommand "check-actionlint" {} '' +runCommand "check-actionlint" { } '' ${lib.getExe actionlint} ${root}/.github/workflows/* touch $out '' diff --git a/checks/alejandra/package.nix b/checks/alejandra/package.nix index 1f2c995..2025de8 100644 --- a/checks/alejandra/package.nix +++ b/checks/alejandra/package.nix @@ -4,7 +4,7 @@ root, alejandra, }: -runCommand "check-alejandra" {} '' +runCommand "check-alejandra" { } '' ${lib.getExe alejandra} --check ${root} touch $out '' diff --git a/checks/biome-fmt/package.nix b/checks/biome-fmt/package.nix index 11d967c..3c6cbc9 100644 --- a/checks/biome-fmt/package.nix +++ b/checks/biome-fmt/package.nix @@ -4,7 +4,7 @@ root, biome, }: -runCommand "check-biome-fmt" {} '' +runCommand "check-biome-fmt" { } '' ${lib.getExe biome} format ${root}/**/* touch $out '' diff --git a/checks/biome-lint/package.nix b/checks/biome-lint/package.nix index b575d34..c9720e8 100644 --- a/checks/biome-lint/package.nix +++ b/checks/biome-lint/package.nix @@ -4,7 +4,7 @@ root, biome, }: -runCommand "check-biome-lint" {} '' +runCommand "check-biome-lint" { } '' ${lib.getExe biome} lint ${root}/**/* touch $out '' diff --git a/checks/deadnix/package.nix b/checks/deadnix/package.nix index 9faaea5..989f81d 100644 --- a/checks/deadnix/package.nix +++ b/checks/deadnix/package.nix @@ -4,7 +4,7 @@ root, deadnix, }: -runCommand "check-deadnix" {} '' +runCommand "check-deadnix" { } '' ${lib.getExe deadnix} --fail ${root} touch $out '' diff --git a/checks/editorconfig/package.nix b/checks/editorconfig/package.nix index 97b2a31..5dc71f0 100644 --- a/checks/editorconfig/package.nix +++ b/checks/editorconfig/package.nix @@ -4,7 +4,7 @@ root, editorconfig-checker, }: -runCommand "check-editorconfig" {} '' +runCommand "check-editorconfig" { } '' cd ${root} ${lib.getExe editorconfig-checker} -exclude '.git' . touch $out diff --git a/checks/nixfmt/package.nix b/checks/nixfmt/package.nix index ab4d88c..faff3c1 100644 --- a/checks/nixfmt/package.nix +++ b/checks/nixfmt/package.nix @@ -4,7 +4,7 @@ nixfmt-rfc-style, root, }: -runCommand "check-nixfmt" {} '' +runCommand "check-nixfmt" { } '' ${lib.getExe nixfmt-rfc-style} --check ${root} touch $out '' diff --git a/checks/prettier/package.nix b/checks/prettier/package.nix index 03be49c..1fa9de5 100644 --- a/checks/prettier/package.nix +++ b/checks/prettier/package.nix @@ -4,7 +4,7 @@ root, nodePackages, }: -runCommand "check-prettier" {} '' +runCommand "check-prettier" { } '' cd ${root} ${lib.getExe nodePackages.prettier} --ignore-path '.git' --check . touch $out diff --git a/checks/rustfmt/package.nix b/checks/rustfmt/package.nix index ef12b49..26a445a 100644 --- a/checks/rustfmt/package.nix +++ b/checks/rustfmt/package.nix @@ -4,8 +4,15 @@ cargo, rustfmt, }: -runCommand "check-rustfmt" {nativeBuildInputs = [cargo rustfmt];} '' - cd ${root} - cargo fmt -- --check - touch $out -'' +runCommand "check-rustfmt" + { + nativeBuildInputs = [ + cargo + rustfmt + ]; + } + '' + cd ${root} + cargo fmt -- --check + touch $out + '' diff --git a/checks/selene/package.nix b/checks/selene/package.nix index cc9f15f..5aba1fc 100644 --- a/checks/selene/package.nix +++ b/checks/selene/package.nix @@ -4,7 +4,7 @@ root, selene, }: -runCommand "check-selene" {} '' +runCommand "check-selene" { } '' cd ${root} ${lib.getExe selene} . touch $out diff --git a/checks/statix/package.nix b/checks/statix/package.nix index aa0a478..bbebf24 100644 --- a/checks/statix/package.nix +++ b/checks/statix/package.nix @@ -4,7 +4,7 @@ root, statix, }: -runCommand "check-statix" {} '' +runCommand "check-statix" { } '' ${lib.getExe statix} check ${root} touch $out '' diff --git a/checks/stylua/package.nix b/checks/stylua/package.nix index 57b439b..20cb876 100644 --- a/checks/stylua/package.nix +++ b/checks/stylua/package.nix @@ -4,7 +4,7 @@ root, stylua, }: -runCommand "check-stylua" {} '' +runCommand "check-stylua" { } '' ${lib.getExe stylua} --check ${root} touch $out '' diff --git a/default.nix b/default.nix index d66666e..5f64ef0 100644 --- a/default.nix +++ b/default.nix @@ -1,10 +1,8 @@ { - mkChecks = { - pkgs, - root, - }: + mkChecks = + { pkgs, root }: pkgs.lib.packagesFromDirectoryRecursive { - callPackage = path: attrs: pkgs.callPackage path ({inherit root;} // attrs); + callPackage = path: attrs: pkgs.callPackage path ({ inherit root; } // attrs); directory = ./checks; }; } diff --git a/template/flake.nix b/template/flake.nix index 4a06e40..35515da 100644 --- a/template/flake.nix +++ b/template/flake.nix @@ -5,23 +5,28 @@ flake-checks.url = "github:getchoo/flake-checks"; }; - outputs = { - nixpkgs, - flake-utils, - flake-checks, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - flake-checks' = flake-checks.lib.mkChecks { - inherit pkgs; - root = ./.; - }; - in { - checks = { - check-actionlint = flake-checks'.actionlint; - check-alejandra = flake-checks'.alejandra; - check-deadnix = flake-checks'.deadnix; - }; - }); + outputs = + { + nixpkgs, + flake-utils, + flake-checks, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + flake-checks' = flake-checks.lib.mkChecks { + inherit pkgs; + root = ./.; + }; + in + { + checks = { + check-actionlint = flake-checks'.actionlint; + check-deadnix = flake-checks'.deadnix; + check-nixfmt = flake-checks'.nixfmt; + }; + } + ); } diff --git a/test/flake.nix b/test/flake.nix index fdf8833..d7ed855 100644 --- a/test/flake.nix +++ b/test/flake.nix @@ -4,19 +4,20 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { - nixpkgs, - flake-utils, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages.${system}; - flake-checks' = (import ../.).mkChecks { - inherit pkgs; - root = ../.; - }; - in { - # we use alejandra, so nixfmt will always fail - checks = builtins.removeAttrs flake-checks' ["nixfmt"]; - }); + outputs = + { nixpkgs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + flake-checks' = (import ../.).mkChecks { + inherit pkgs; + root = ../.; + }; + in + { + # we use nixfmt, so alejandra will always fail + checks = builtins.removeAttrs flake-checks' [ "alejandra" ]; + } + ); } |
