2021-04-18 04:29:45 +02:00
|
|
|
{ lib }:
|
2021-03-14 08:10:51 +01: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-26 22:41:10 +01:00
|
|
|
|
2021-04-27 18:30:28 +02:00
|
|
|
safeReadDir = path:
|
|
|
|
lib.optionalAttrs (builtins.pathExists (toString path)) (builtins.readDir (toString path));
|
2021-03-14 08:10:51 +01:00
|
|
|
}
|