diff options
author | Azat Bahawi <azat@bahawi.net> | 2022-09-16 15:13:19 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2022-09-16 15:13:19 +0300 |
commit | 751694df63b34946e1a79d379eac8c35ba40eed1 (patch) | |
tree | e1ac51c7ddca63c01c7042f84a0017dd8f75e5fb /lib | |
parent | 2022-09-14 (diff) |
2022-09-16
Diffstat (limited to '')
-rw-r--r-- | lib/default.nix | 16 |
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]); } |