Merge pull request #349 from hercules-ci/issue-348

fix(inputs'): do not unnecessarily evaluate formatters
This commit is contained in:
Robert Hensing 2026-05-04 12:53:41 +01:00 committed by GitHub
commit ae2918651e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 28 additions and 4 deletions

View file

@ -567,6 +567,31 @@ in
}; };
}; };
perInput = {
"test: inputs' does not evaluate input flake formatter" =
let
inputFlake = {
_type = "flake";
outPath = "/fake";
formatter = throw "must not evaluate input's formatter";
packages.a.hello = pkg "a" "hello";
};
self = { _type = "flake"; outPath = "/test"; inputs = { inherit self; dep = inputFlake; }; };
result = mkFlake
{ inputs = self.inputs; }
{
systems = [ "a" ];
perSystem = { inputs', ... }: {
packages.default = inputs'.dep.packages.hello;
};
};
in
{
expr = (result.packages.a.default).name;
expected = "hello";
};
};
formatter = { formatter = {
"test: conditional null throws helpful error" = { "test: conditional null throws helpful error" = {
expr = expr =

View file

@ -100,10 +100,9 @@ in
'') '')
config.allSystems); config.allSystems);
perInput = system: flake: perInput = system: flake: {
optionalAttrs (flake?formatter.${system}) { formatter = flake.formatter.${system};
formatter = flake.formatter.${system}; };
};
}; };
} }