summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2018-11-30 20:42:01 +0100
committerlassulus <lassulus@lassul.us>2018-11-30 20:42:01 +0100
commit11aea15ec0207cbd081c0c1a8ba205f95308c7ae (patch)
tree1ce81d22809ad08482280f3844d781c42fca80df /lib
parent8d87e4b8909adff80f9b9dd83fe177a3dff8918d (diff)
parent5d0bd94dd9002a0c65bdc76eedde15a07937087e (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix
index a40225c..4cb0332 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; };
@@ -44,6 +45,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