Merge pull request #167947 from MatthewCroughan/mc/callLocklessFlake
lib: add callLocklessFlakemain
commit
a5357d06e4
@ -0,0 +1,22 @@ |
|||||||
|
{ lib }: |
||||||
|
|
||||||
|
rec { |
||||||
|
|
||||||
|
/* imports a flake.nix without acknowledging its lock file, useful for |
||||||
|
referencing subflakes from a parent flake. The second argument allows |
||||||
|
specifying the inputs of this flake. |
||||||
|
|
||||||
|
Example: |
||||||
|
callLocklessFlake { |
||||||
|
path = ./directoryContainingFlake; |
||||||
|
inputs = { inherit nixpkgs; }; |
||||||
|
} |
||||||
|
*/ |
||||||
|
callLocklessFlake = { path, inputs ? { } }: |
||||||
|
let |
||||||
|
self = { outPath = path; } // |
||||||
|
((import (path + "/flake.nix")).outputs (inputs // { self = self; })); |
||||||
|
in |
||||||
|
self; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
{ |
||||||
|
outputs = { self, subflake, callLocklessFlake }: rec { |
||||||
|
x = (callLocklessFlake { |
||||||
|
path = subflake; |
||||||
|
inputs = {}; |
||||||
|
}).subflakeOutput; |
||||||
|
}; |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
{ |
||||||
|
outputs = { self }: { |
||||||
|
subflakeOutput = 1; |
||||||
|
}; |
||||||
|
} |
Loading…
Reference in new issue