diff options
author | tv <tv@krebsco.de> | 2016-06-30 20:31:43 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-06-30 20:31:43 +0200 |
commit | 7b46ccaba5e3c6cd24cf821c5f848c3e4d636512 (patch) | |
tree | c3cc8930af338e824a8b484a2af0e65b8b6bea6b /krebs/4lib/default.nix | |
parent | 0add7e1a47f4e4c8fd3c122ea25a0e6cf7d5e6fe (diff) |
lib.getAttrs: init
Diffstat (limited to 'krebs/4lib/default.nix')
-rw-r--r-- | krebs/4lib/default.nix | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix index afff17296..296748333 100644 --- a/krebs/4lib/default.nix +++ b/krebs/4lib/default.nix @@ -58,6 +58,10 @@ let out = rec { genAttrs' = names: f: listToAttrs (map f names); + getAttrs = names: set: + listToAttrs (map (name: nameValuePair name set.${name}) + (filter (flip hasAttr set) names)); + setAttr = name: value: set: set // { ${name} = value; }; optionalTrace = c: msg: x: if c then trace msg x else x; |