lib: add mapNixDir{,1}
This commit is contained in:
parent
53359a60f5
commit
5f0b1b8035
|
@ -15,10 +15,4 @@ let
|
|||
else override;
|
||||
in
|
||||
|
||||
listToAttrs
|
||||
(map
|
||||
(name: nameValuePair (removeSuffix ".nix" name)
|
||||
(callPackage (./. + "/${name}") {}))
|
||||
(filter
|
||||
(name: name != "default.nix" && !hasPrefix "." name)
|
||||
(attrNames (readDir ./.))))
|
||||
mapNixDir (path: callPackage path {}) ./.
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
with import <stockholm/lib>;
|
||||
let
|
||||
overrides = self: super:
|
||||
listToAttrs
|
||||
(map
|
||||
(name: nameValuePair (removeSuffix ".nix" name)
|
||||
(self.callPackage (./. + "/${name}") {}))
|
||||
(filter
|
||||
(name: name != "default.nix" && !hasPrefix "." name)
|
||||
(attrNames (readDir ./.))));
|
||||
overrides = self: super: mapNixDir (path: self.callPackage path {}) ./.;
|
||||
in
|
||||
self: super:
|
||||
{
|
||||
|
|
|
@ -15,10 +15,4 @@ let
|
|||
else override;
|
||||
in
|
||||
|
||||
listToAttrs
|
||||
(map
|
||||
(name: nameValuePair (removeSuffix ".nix" name)
|
||||
(callPackage (./. + "/${name}") {}))
|
||||
(filter
|
||||
(name: name != "default.nix" && !hasPrefix "." name)
|
||||
(attrNames (readDir ./.))))
|
||||
mapNixDir (path: callPackage path {}) ./.
|
||||
|
|
|
@ -44,6 +44,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
|
||||
|
|
|
@ -15,10 +15,4 @@ let
|
|||
else override;
|
||||
in
|
||||
|
||||
listToAttrs
|
||||
(map
|
||||
(name: nameValuePair (removeSuffix ".nix" name)
|
||||
(callPackage (./. + "/${name}") {}))
|
||||
(filter
|
||||
(name: name != "default.nix" && !hasPrefix "." name)
|
||||
(attrNames (readDir ./.))))
|
||||
mapNixDir (path: callPackage path {}) ./.
|
||||
|
|
Loading…
Reference in a new issue