about summary refs log tree commit diff
path: root/lib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/default.nix')
-rw-r--r--lib/default.nix30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 662938e..3a67063 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -4,7 +4,6 @@
   system,
   ...
 }:
-with lib;
 rec {
   my = import ./my.nix { inherit lib inputs system; };
 
@@ -12,6 +11,10 @@ rec {
 
   packages = import ./packages.nix { inherit lib inputs system; };
 
+  infuse = import inputs.infuse {
+    inherit lib;
+  };
+
   isEven =
     number:
     assert (builtins.isInt number) || (builtins.isFloat number);
@@ -28,7 +31,7 @@ rec {
   mkTcpMem =
     min: ini: max:
     assert min <= ini && ini <= max;
-    concatMapStrings (x: toString x + " ") (
+    lib.concatMapStrings (x: toString x + " ") (
       map (pow 2) [
         min
         ini
@@ -49,22 +52,22 @@ rec {
   #
   modulesIn =
     dir:
-    pipe dir [
+    lib.pipe dir [
       builtins.readDir
-      (mapAttrsToList (
+      (lib.mapAttrsToList (
         name: type:
         let
           modulePath = dir + "/${name}";
         in
-        if type == "regular" && hasSuffix ".nix" name && name != "default.nix" then
-          [ (nameValuePair (removeSuffix ".nix" name) modulePath) ]
-        else if type == "directory" && pathExists (modulePath + "/default.nix") then
-          [ (nameValuePair name modulePath) ]
+        if type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix" then
+          [ (lib.nameValuePair (lib.removeSuffix ".nix" name) modulePath) ]
+        else if type == "directory" && lib.pathExists (modulePath + "/default.nix") then
+          [ (lib.nameValuePair name modulePath) ]
         else
           [ ]
       ))
-      concatLists
-      listToAttrs
+      lib.concatLists
+      lib.listToAttrs
     ];
 
   # Override a module using another Nixpkgs source tree.
@@ -99,9 +102,9 @@ rec {
           src = inputs.nixpkgs.legacyPackages.${system}.fetchzip {
             url =
               let
-                cons = splitString ":" ref;
-                owner = head cons;
-                branch = last cons;
+                cons = lib.splitString ":" ref;
+                owner = lib.head cons;
+                branch = lib.last cons;
               in
               "https://github.com/${owner}/nixpkgs/archive/refs/heads/${branch}.tar.gz";
             inherit sha256;
@@ -111,5 +114,4 @@ rec {
       )
     ];
   };
-
 }

Consider giving Nix/NixOS a try! <3