about summary refs log tree commit diff
path: root/lib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/default.nix16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 7a8dfbf..6517125 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -14,7 +14,19 @@ lib: _: rec {
     assert exponent > 0;
       builtins.foldl' (x: _: x * base) 1 (builtins.genList _ exponent);
 
-  comcat = lib.concatStringsSep ",";
+  comcat = builtins.concatStringsSep ",";
 
-  mkTcpMem = min: ini: max: (lib.concatMapStrings (x: toString x + " ") [(pow 2 min) (pow 2 ini) (pow 2 max)]);
+  mapListToAttrs = f: xs:
+    builtins.listToAttrs (map (name: {
+        name =
+          if builtins.isList name
+          then builtins.elemAt name (builtins.length name - 1)
+          else name;
+        value = f name;
+      })
+      xs);
+
+  mkTcpMem = min: ini: max:
+    assert min <= ini && ini <= max;
+      builtins.concatMapStrings (x: toString x + " ") (map (pow 2) [min ini max]);
 }

Consider giving Nix/NixOS a try! <3