nilla: add ci.check
All checks were successful
/ check (push) Successful in 2m3s

This commit is contained in:
Nikodem Rabuliński 2025-04-01 19:13:17 +02:00
parent 48fe28205f
commit 41e81a16f1
Signed by: nrabulinski
SSH key fingerprint: SHA256:AZZVyfKStaCo8sbJB+3Rr/CRrlym1oEgw7vMnynJeR8
3 changed files with 45 additions and 1 deletions

View file

@ -8,4 +8,4 @@ jobs:
runs-on: native
steps:
- uses: actions/checkout@v4
- run: nix flake check --all-systems
- run: nix-build -A ci.check

8
default.nix Normal file
View file

@ -0,0 +1,8 @@
let
nilla = import ./nilla.nix { };
getPackage = name: nilla.packages.${name}.result.${builtins.currentSystem};
in
{
ci.check = getPackage "ci-check";
formatter = getPackage "formatter";
}

View file

@ -76,6 +76,42 @@
in
eval.config.build.wrapper;
};
ci-check =
let
all-packages = builtins.attrValues (builtins.removeAttrs config.packages [ "ci-check" ]);
all-packages' = lib.lists.flatten (map (pkg: builtins.attrValues pkg.result) all-packages);
nixos-systems = builtins.attrValues config.systems.nixos;
nixos-systems' = map (system: system.result.config.system.build.toplevel) nixos-systems;
darwin-systems = builtins.attrValues config.systems.darwin;
darwin-systems' = map (system: system.result.config.system.build.toplevel) darwin-systems;
all-drvs = all-packages' ++ nixos-systems' ++ darwin-systems';
all-drvs' = lib.strings.concatMapSep "\n" builtins.unsafeDiscardStringContext all-drvs;
in
mkPackage (
{
lib,
stdenvNoCC,
system,
}:
stdenvNoCC.mkDerivation {
name = "nilla-eval-check";
src = lib.cleanSource ./.;
doCheck = true;
allDerivations = all-drvs';
formatter = lib.getExe config.packages.formatter.result.${system};
passAsFile = [ "allDerivations" ];
installPhase = ''touch "$out"'';
checkPhase = ''
"$formatter" --ci
'';
}
);
};
config.shells.default = {