Allow calling flakes without a flake.lock #5
10
default.nix
10
default.nix
|
@ -54,6 +54,12 @@ let
|
||||||
assert flake.edition == 201909;
|
assert flake.edition == 201909;
|
||||||
outputs;
|
outputs;
|
||||||
|
|
||||||
|
callLocklessFlake = flakeSrc:
|
||||||
|
let
|
||||||
|
flake = import (flakeSrc + "/flake.nix");
|
||||||
|
outputs = flakeSrc // (flake.outputs ({ self = outputs; }));
|
||||||
|
in outputs;
|
||||||
|
|
||||||
rootSrc = let
|
rootSrc = let
|
||||||
dir = builtins.readDir src;
|
dir = builtins.readDir src;
|
||||||
gitDir = builtins.readDir (src + "/.git");
|
gitDir = builtins.readDir (src + "/.git");
|
||||||
|
@ -144,7 +150,9 @@ let
|
||||||
lockFile.nodes;
|
lockFile.nodes;
|
||||||
|
|
||||||
result =
|
result =
|
||||||
if lockFile.version == 4
|
if !(builtins.pathExists lockFilePath)
|
||||||
|
then callLocklessFlake rootSrc
|
||||||
|
else if lockFile.version == 4
|
||||||
then callFlake4 rootSrc (lockFile.inputs)
|
then callFlake4 rootSrc (lockFile.inputs)
|
||||||
else if lockFile.version >= 5 && lockFile.version <= 7
|
else if lockFile.version >= 5 && lockFile.version <= 7
|
||||||
then allNodes.${lockFile.root}
|
then allNodes.${lockFile.root}
|
||||||
|
|
Loading…
Reference in a new issue