It is good for if I am making a nix update script that needs network access or some other impurity (although this is probably what nix-prefetch-git is for but it's good to know how to do it manually, especially for something like recreating a lockfile)
14 lines
404 B
Nix
14 lines
404 B
Nix
(import
|
|
(
|
|
let
|
|
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
|
nodeName = lock.nodes.root.inputs.flake-compat;
|
|
in
|
|
fetchTarball {
|
|
url = lock.nodes.${nodeName}.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
|
|
sha256 = lock.nodes.${nodeName}.locked.narHash;
|
|
}
|
|
)
|
|
{ src = ./.; }
|
|
).defaultNix
|