lib: add callLocklessFlake
This is essentially a copy of the function of the same name, from flake-compat. callLocklessFlake is useful when trying to utilise a flake.nix without a lock file, often for when you want to create a subflake from within a parent flake. Co-authored-by: Tom Bereknyei <tomberek@gmail.com> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This commit is contained in:
parent
16e5a1a19e
commit
c190b08bb7
@ -64,7 +64,7 @@ let
|
|||||||
hasAttr head isAttrs isBool isInt isList isString length
|
hasAttr head isAttrs isBool isInt isList isString length
|
||||||
lessThan listToAttrs pathExists readFile replaceStrings seq
|
lessThan listToAttrs pathExists readFile replaceStrings seq
|
||||||
stringLength sub substring tail trace;
|
stringLength sub substring tail trace;
|
||||||
inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor
|
inherit (self.trivial) id callLocklessFlake const pipe concat or and bitAnd bitOr bitXor
|
||||||
bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
|
bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max
|
||||||
importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum
|
importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum
|
||||||
info showWarnings nixpkgsVersion version isInOldestRelease
|
info showWarnings nixpkgsVersion version isInOldestRelease
|
||||||
|
@ -13,6 +13,22 @@ rec {
|
|||||||
# The value to return
|
# The value to return
|
||||||
x: x;
|
x: x;
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
|
||||||
/* The constant function
|
/* The constant function
|
||||||
|
|
||||||
Ignores the second argument. If called with only one argument,
|
Ignores the second argument. If called with only one argument,
|
||||||
|
Loading…
Reference in New Issue
Block a user