Skip to content

Commit

Permalink
Fix non-fetchTree pure-eval use of builtins.path
Browse files Browse the repository at this point in the history
This is a rare combination, and it would have been more relevant
before #67, but it is a
tested fix nonetheless.
(Specifically, for issues like hercules-ci/flake-parts#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`.
  • Loading branch information
roberth committed Dec 4, 2024
1 parent 9ed2ac1 commit a220b6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let
} else {
})
else if info.type == "path" then
{ outPath = builtins.path { path = info.path; };
{ outPath = builtins.path { path = info.path; sha256 = info.narHash; };
narHash = info.narHash;
}
else if info.type == "tarball" then
Expand Down

0 comments on commit a220b6b

Please sign in to comment.