summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-06-30 20:31:43 +0200
committertv <tv@krebsco.de>2016-06-30 20:31:43 +0200
commit7b46ccaba5e3c6cd24cf821c5f848c3e4d636512 (patch)
treec3cc8930af338e824a8b484a2af0e65b8b6bea6b /krebs
parent0add7e1a47f4e4c8fd3c122ea25a0e6cf7d5e6fe (diff)
lib.getAttrs: init
Diffstat (limited to 'krebs')
-rw-r--r--krebs/4lib/default.nix4
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;