summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-03-16 01:52:34 +0100
committertv <tv@krebsco.de>2016-03-16 01:52:34 +0100
commite6657cd46a6b97153f80006144fe6293f715bb7d (patch)
tree90dc8264179bc972813f3130e06b8a47139b3ff1
parentfb82aa8f34977de004df09d9e76c506557235d15 (diff)
krebs lib += getAttrDef
-rw-r--r--krebs/4lib/default.nix1
1 files changed, 1 insertions, 0 deletions
diff --git a/krebs/4lib/default.nix b/krebs/4lib/default.nix
index e984614a0..585bd313f 100644
--- a/krebs/4lib/default.nix
+++ b/krebs/4lib/default.nix
@@ -41,6 +41,7 @@ let out = rec {
mapAttrs (name: _: path + "/${name}")
(filterAttrs (_: eq "directory") (readDir path));
+ getAttrDef = name: set: set.${name} or set.default or null;
mapAttrValues = f: mapAttrs (_: f);
setAttr = name: value: set: set // { ${name} = value; };