e7c0700959
Create fetch function which takes a valid flake input, and calls fetchTarball with the revision and hash information from the flake.lock. Useful for pulling the exact revision of flake inputs from not flake expressions, such as those in shell.nix.
17 lines
333 B
Nix
17 lines
333 B
Nix
let
|
|
inherit (builtins)
|
|
fetchTarball
|
|
fromJSON
|
|
readFile
|
|
;
|
|
lockfile = fromJSON (readFile ../flake.lock);
|
|
in
|
|
input:
|
|
let
|
|
locked = lockfile.nodes."${input}".locked;
|
|
inherit (locked) rev narHash owner repo;
|
|
in
|
|
fetchTarball {
|
|
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
|
|
sha256 = narHash;
|
|
}
|