Compare commits

..

1 commit

View file

@ -7,76 +7,77 @@
pkgs, pkgs,
... ...
}: }:
let
mkLint =
{
name,
fileset,
checkInputs ? [ ],
script,
}:
pkgs.stdenvNoCC.mkDerivation {
inherit name;
src = lib.fileset.toSource {
root = ../.;
fileset = lib.fileset.difference fileset (
lib.fileset.fileFilter (
file: file.type != "regular" || file.name == "hardware-configuration.nix"
) ../.
);
};
checkInputs = [ pkgs.nushell ] ++ checkInputs;
checkPhase = ''
nu -c '${script}' | tee $out
'';
dontPatch = true;
dontConfigure = true;
dontBuild = true;
dontInstall = true;
dontFixup = true;
doCheck = true;
};
in
{ {
checks = { checks =
nix = mkLint { let
name = "nix-lints"; mkLint =
fileset = lib.fileset.fileFilter (file: file.hasExt "nix") ../.; {
name,
fileset,
checkInputs ? [ ],
script,
}:
pkgs.stdenvNoCC.mkDerivation {
inherit name;
checkInputs = lib.attrValues { src = lib.fileset.toSource {
inherit (pkgs) deadnix nixfmt-rfc-style; root = ../.;
fileset = lib.fileset.difference fileset (
lib.fileset.fileFilter (
file: file.type != "regular" || file.name == "hardware-configuration.nix"
) ../.
);
};
statix = pkgs.statix.overrideAttrs (old: { checkInputs = [ pkgs.nushell ] ++ checkInputs;
patches = old.patches ++ [
(pkgs.fetchpatch { checkPhase = ''
url = "https://github.com/oppiliappan/statix/commit/925dec39bb705acbbe77178b4d658fe1b752abbb.patch"; nu -c '${script}' | tee $out
hash = "sha256-0wacO6wuYJ4ufN9PGucRVJucFdFFNF+NoHYIrLXsCWs="; '';
})
]; dontPatch = true;
}); dontConfigure = true;
dontBuild = true;
dontInstall = true;
dontFixup = true;
doCheck = true;
};
in
{
nix = mkLint {
name = "nix-lints";
fileset = lib.fileset.fileFilter (file: file.hasExt "nix") ../.;
checkInputs = lib.attrValues {
inherit (pkgs) deadnix nixfmt-rfc-style;
statix = pkgs.statix.overrideAttrs (old: {
patches = old.patches ++ [
(pkgs.fetchpatch {
url = "https://github.com/oppiliappan/statix/commit/925dec39bb705acbbe77178b4d658fe1b752abbb.patch";
hash = "sha256-0wacO6wuYJ4ufN9PGucRVJucFdFFNF+NoHYIrLXsCWs=";
})
];
});
};
script = /* bash */ ''
statix check **/*.nix
deadnix --fail **/*.nix
nixfmt --check --strict **/*.nix
'';
}; };
script = /* bash */ '' lockfile = mkLint {
statix check **/*.nix name = "nix-lockfile";
deadnix --fail **/*.nix fileset = ../flake.lock;
nixfmt --check --strict **/*.nix checkInputs = lib.attrValues { inherit (inputs'.flint.packages) flint; };
'';
};
lockfile = mkLint { script = /* bash */ ''
name = "nix-lockfile"; flint --fail-if-multiple-versions
fileset = ../flake.lock; '';
checkInputs = lib.attrValues { inherit (inputs'.flint.packages) flint; }; };
}
script = /* bash */ '' // self.nixosConfigurations.hetzner-1.config.serviceTests;
flint --fail-if-multiple-versions
'';
};
}
// self.nixosConfigurations.hetzner-1.config.serviceTests;
}; };
} }