summaryrefslogtreecommitdiffstats
path: root/lib/default.nix
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-12-04 19:27:27 +0100
committerjeschli <jeschli@gmail.com>2018-12-04 19:27:27 +0100
commit5030b74cc5c578bb82619a24592504a6008f1a10 (patch)
tree0551e3ddb94353b7438bec02174bf3379bc89b87 /lib/default.nix
parent78b289201987675844aa37abeb4279eb4051ebe0 (diff)
parent82988de84c177c247ebbe80940c4d50b9f073b4e (diff)
Merge branch 'master' of prism.r:stockholm
Diffstat (limited to 'lib/default.nix')
-rw-r--r--lib/default.nix23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/default.nix b/lib/default.nix
index a40225c49..348d47e85 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -5,6 +5,7 @@ let
evalSource = import ./eval-source.nix;
git = import ./git.nix { inherit lib; };
+ krops = import ../submodules/krops/lib;
shell = import ./shell.nix { inherit lib; };
types = nixpkgs-lib.types // import ./types.nix { inherit lib; };
@@ -12,8 +13,9 @@ let
ne = x: y: x != y;
mod = x: y: x - y * (x / y);
- genid = import ./genid.nix { inherit lib; };
- genid_uint31 = x: ((lib.genid x) + 16777216) / 2;
+ genid = lib.genid_uint32; # TODO remove
+ genid_uint31 = x: ((lib.genid_uint32 x) + 16777216) / 2;
+ genid_uint32 = import ./genid.nix { inherit lib; };
lpad = n: c: s:
if lib.stringLength s < n
@@ -44,6 +46,23 @@ let
indent = replaceChars ["\n"] ["\n "];
+ mapNixDir = f: x: {
+ list = foldl' mergeAttrs {} (map (mapNixDir1 f) x);
+ path = mapNixDir1 f x;
+ }.${typeOf x};
+
+ mapNixDir1 = f: dirPath:
+ listToAttrs
+ (map
+ (relPath: let
+ name = removeSuffix ".nix" relPath;
+ path = dirPath + "/${relPath}";
+ in
+ nameValuePair name (f path))
+ (filter
+ (name: name != "default.nix" && !hasPrefix "." name)
+ (attrNames (readDir dirPath))));
+
# https://tools.ietf.org/html/rfc5952
normalize-ip6-addr =
let