From 751694df63b34946e1a79d379eac8c35ba40eed1 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Fri, 16 Sep 2022 15:13:19 +0300 Subject: 2022-09-16 --- lib/default.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib') 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]); } -- cgit 1.4.1