about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/default.nix6
-rw-r--r--lib/flakes.nix22
-rw-r--r--lib/trivial.nix16
3 files changed, 27 insertions, 17 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 7d20acc679482..8d7cc20ae4826 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
diff --git a/lib/flakes.nix b/lib/flakes.nix
new file mode 100644
index 0000000000000..4dc027b6c9b3e
--- /dev/null
+++ b/lib/flakes.nix
@@ -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;
+
+}
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 0b9b6bd910f0e..18616a189c269 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -13,22 +13,6 @@ rec {
     # The value to return
     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
 
      Ignores the second argument. If called with only one argument,