1
0
Fork 0
mirror of https://github.com/edolstra/flake-compat.git synced 2024-12-14 11:47:34 +00:00

Fix non-fetchTree pure-eval use of builtins.path

This is a rare combination, and it would have been more relevant
before https://github.com/edolstra/flake-compat/pull/67, but it is a
tested fix nonetheless.
(Specifically, for issues like https://github.com/hercules-ci/flake-parts/issues/252)

builtins.path had `sha256` since its introduction, so no problem
there.

This also catches accidental path-based impurities. Flakes are meant
to be pure. "path" inputs do ask for trouble, but that doesn't mean
we should violate purity.
Also note that `fetchTree` will happily use the `narHash` anyway, so
this change makes the behavior more consistent between configurations
with and without `fetchTree`.
This commit is contained in:
Robert Hensing 2024-12-04 12:17:25 +01:00
parent 9ed2ac151e
commit a220b6b7b9

View file

@ -45,7 +45,7 @@ let
} else { } else {
}) })
else if info.type == "path" then else if info.type == "path" then
{ outPath = builtins.path { path = info.path; }; { outPath = builtins.path { path = info.path; sha256 = info.narHash; };
narHash = info.narHash; narHash = info.narHash;
} }
else if info.type == "tarball" then else if info.type == "tarball" then