From 7b46ccaba5e3c6cd24cf821c5f848c3e4d636512 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 30 Jun 2016 20:31:43 +0200 Subject: lib.getAttrs: init --- krebs/4lib/default.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'krebs/4lib') 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; -- cgit v1.2.3