nix: Add linting

pull/27/head
Tristan Daniël Maat 2024-01-02 15:06:58 +01:00
parent 40e0946201
commit 833f97c3d3
Signed by: tlater
GPG Key ID: 49670FD774E43268
4 changed files with 30 additions and 3 deletions

View File

@ -74,7 +74,7 @@
};
checks.${system} = import ./nix/checks {
inherit self system pkgs;
inherit self pkgs;
};
};
}

View File

@ -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 {};
}

27
nix/checks/lint-nix.nix Normal file
View 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
'';
}

View File

@ -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;