nix: Add linting
This commit is contained in:
parent
40e0946201
commit
833f97c3d3
|
@ -74,7 +74,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
checks.${system} = import ./nix/checks {
|
checks.${system} = import ./nix/checks {
|
||||||
inherit self system pkgs;
|
inherit self pkgs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
self,
|
self,
|
||||||
system,
|
|
||||||
}: let
|
}: let
|
||||||
callPackage = pkgs.lib.callPackageWith (pkgs // {inherit self;});
|
callPackage = pkgs.lib.callPackageWith (pkgs // {inherit self;});
|
||||||
in {
|
in {
|
||||||
|
lintNix = callPackage ./lint-nix.nix {};
|
||||||
openHomepage = callPackage ./open-homepage.nix {};
|
openHomepage = callPackage ./open-homepage.nix {};
|
||||||
}
|
}
|
||||||
|
|
27
nix/checks/lint-nix.nix
Normal file
27
nix/checks/lint-nix.nix
Normal file
|
@ -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
|
||||||
|
'';
|
||||||
|
}
|
|
@ -7,7 +7,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) mkEnableOption mkIf mkOption;
|
inherit (lib) mkEnableOption mkIf mkOption;
|
||||||
inherit (lib.types) submodule str int;
|
inherit (lib.types) str int;
|
||||||
inherit (lib.strings) escapeShellArgs;
|
inherit (lib.strings) escapeShellArgs;
|
||||||
inherit (self.packages.${system}) server templates;
|
inherit (self.packages.${system}) server templates;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue