diff --git a/flake.nix b/flake.nix index bc7a49a..353fa71 100644 --- a/flake.nix +++ b/flake.nix @@ -74,7 +74,7 @@ }; checks.${system} = import ./nix/checks { - inherit self system pkgs; + inherit self pkgs; }; }; } diff --git a/nix/checks/default.nix b/nix/checks/default.nix index fa4be77..1d24e35 100644 --- a/nix/checks/default.nix +++ b/nix/checks/default.nix @@ -1,9 +1,9 @@ { pkgs, self, - system, }: let callPackage = pkgs.lib.callPackageWith (pkgs // {inherit self;}); in { + lintNix = callPackage ./lint-nix.nix {}; openHomepage = callPackage ./open-homepage.nix {}; } diff --git a/nix/checks/lint-nix.nix b/nix/checks/lint-nix.nix new file mode 100644 index 0000000..aed1fb1 --- /dev/null +++ b/nix/checks/lint-nix.nix @@ -0,0 +1,27 @@ +{ + self, + lib, + stdenv, + alejandra, + deadnix, + statix, +}: let + inherit (lib) sourceFilesBySuffices; +in + stdenv.mkDerivation { + dontPatch = true; + dontConfigure = true; + dontBuild = true; + dontInstall = true; + doCheck = true; + + name = "lint-nix"; + src = sourceFilesBySuffices self [".nix"]; + checkInputs = [alejandra deadnix statix]; + checkPhase = '' + mkdir -p $out + alejandra --check . | tee $out/alejandra.log + deadnix --fail | tee $out/deadnix.log + statix check | tee $out/statix.log + ''; + } diff --git a/nix/module.nix b/nix/module.nix index 6515c54..b2279e1 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -7,7 +7,7 @@ ... }: let inherit (lib) mkEnableOption mkIf mkOption; - inherit (lib.types) submodule str int; + inherit (lib.types) str int; inherit (lib.strings) escapeShellArgs; inherit (self.packages.${system}) server templates;