diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2017-04-17 16:48:10 -0400 |
---|---|---|
committer | John Ericson <Ericson2314@Yahoo.com> | 2017-04-17 17:04:04 -0400 |
commit | 85aa5005af530fef199cc41148e374e54d70e01e (patch) | |
tree | 296a184cc5e710e197f45a91babb107bf8509eae /lib | |
parent | f3055a3c508b6ff3e926ece201887467dc2b5d73 (diff) |
Introduce `mapNullable` into lib and use it in a few places
Also simply some configure flag logic my grep also alerted me too.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/trivial.nix | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix index 40499b2b5092..b7b9d25922ab 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -108,6 +108,9 @@ rec { # Flip the order of the arguments of a binary function. flip = f: a: b: f b a; + # Apply function if argument is non-null + mapNullable = f: a: if isNull a then a else f a; + # Pull in some builtins not included elsewhere. inherit (builtins) pathExists readFile isBool isFunction |