-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an optional
hash
parameter to builtins.fetchGit
This is particularly useful to ensure the purity e.g. of a repo which is pinned to a git tag (tags can be force-pushed which makes builds silently irreproducible) or when trying to evaluate a nix expression without internet connectivity (if the cache-entry is expired, the eval will break as the git repo can't be re-fetched). This change adds an optional `hash` parameter (with an SRI-hash[1]) to the builtin `fetchGit` and checks if there's a content-addressable path which matches the hash (the hash can be determined using `nix to-sri --type sha256 $(nix-prefetch-git ...)`). If no such path exists, it will be attempted to fetch the Git repository in order to compare the hashes. Please note that caching is still used here, so if the repo is already fetched and the only hash in the expression changes, the evaluation will fail pretty fast. [1] https://www.w3.org/TR/SRI/
- Loading branch information
Showing
3 changed files
with
94 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters