From c190b08bb7793004a4706e008a7d0f9b2be3df70 Mon Sep 17 00:00:00 2001 From: matthewcroughan Date: Sat, 9 Apr 2022 01:05:35 +0100 Subject: 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 Co-authored-by: Robert Hensing --- lib/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/default.nix') diff --git a/lib/default.nix b/lib/default.nix index 1f06283790a8..7d20acc67948 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -64,7 +64,7 @@ let hasAttr head isAttrs isBool isInt isList isString length lessThan listToAttrs pathExists readFile replaceStrings seq 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 importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum info showWarnings nixpkgsVersion version isInOldestRelease -- cgit v1.2.3 From cad8bbe58905a14651a469be78f89cad55ee7c15 Mon Sep 17 00:00:00 2001 From: matthewcroughan Date: Tue, 12 Apr 2022 18:55:41 +0100 Subject: lib: init flakes.nix This commit creates flakes.nix, which is a library containing functions which relate to interacting with flakes. It also moves related functions from trivial.nix into it. --- lib/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/default.nix') diff --git a/lib/default.nix b/lib/default.nix index 7d20acc67948..8d7cc20ae482 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -11,6 +11,9 @@ let callLibs = file: import file { lib = self; }; in { + # interacting with flakes + flakes = callLibs ./flakes.nix; + # often used, or depending on very little trivial = callLibs ./trivial.nix; fixedPoints = callLibs ./fixed-points.nix; @@ -59,12 +62,13 @@ let # linux kernel configuration kernel = callLibs ./kernel.nix; + inherit (self.flakes) callLocklessFlake; inherit (builtins) add addErrorContext attrNames concatLists deepSeq elem elemAt filter genericClosure genList getAttr hasAttr head isAttrs isBool isInt isList isString length lessThan listToAttrs pathExists readFile replaceStrings seq stringLength sub substring tail trace; - inherit (self.trivial) id callLocklessFlake const pipe concat or and bitAnd bitOr bitXor + inherit (self.trivial) id const pipe concat or and bitAnd bitOr bitXor bitNot boolToString mergeAttrs flip mapNullable inNixShell isFloat min max importJSON importTOML warn warnIf warnIfNot throwIf throwIfNot checkListOfEnum info showWarnings nixpkgsVersion version isInOldestRelease -- cgit v1.2.3