From 85aa5005af530fef199cc41148e374e54d70e01e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 17 Apr 2017 16:48:10 -0400 Subject: Introduce `mapNullable` into lib and use it in a few places Also simply some configure flag logic my grep also alerted me too. --- lib/trivial.nix | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/trivial.nix') diff --git a/lib/trivial.nix b/lib/trivial.nix index 40499b2b509..b7b9d25922a 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 -- cgit 1.4.1