mirror of
https://github.com/divnix/digga.git
synced 2024-12-23 16:11:51 +03:00
9f0ecf6920
simple copy of devos library code
20 lines
560 B
Nix
20 lines
560 B
Nix
{ lib }:
|
|
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) { };
|
|
|
|
safeReadDir = path:
|
|
lib.optionalAttrs (builtins.pathExists (toString path)) (builtins.readDir (toString path));
|
|
}
|