2021-04-18 05:29:45 +03:00
|
|
|
{ lib }:
|
2021-03-14 10:10:51 +03:00
|
|
|
rec {
|
|
|
|
# mapFilterAttrs ::
|
|
|
|
# (name -> value -> bool )
|
|
|
|
# (name -> value -> { name = any; value = any; })
|
|
|
|
# attrs
|
|
|
|
mapFilterAttrs = seive: f: attrs:
|
|
|
|
lib.filterAttrs
|
|
|
|
seive
|
|
|
|
(lib.mapAttrs' f attrs);
|
|
|
|
|
|
|
|
# Generate an attribute set by mapping a function over a list of values.
|
|
|
|
genAttrs' = values: f: lib.listToAttrs (map f values);
|
|
|
|
|
|
|
|
concatAttrs = lib.fold (attr: sum: lib.recursiveUpdate sum attr) { };
|
2021-03-27 00:41:10 +03:00
|
|
|
|
2021-04-27 19:30:28 +03:00
|
|
|
safeReadDir = path:
|
|
|
|
lib.optionalAttrs (builtins.pathExists (toString path)) (builtins.readDir (toString path));
|
2021-03-14 10:10:51 +03:00
|
|
|
}
|