Introduce mapNullable into lib and use it in a few places

Also simply some configure flag logic my grep also alerted me too.
This commit is contained in:
John Ericson
2017-04-17 17:04:04 -04:00
parent f3055a3c50
commit 85aa5005af
7 changed files with 18 additions and 14 deletions
+4 -5
View File
@@ -31,11 +31,10 @@ with stdenv;
with stdenv.lib;
let
inherit (python2Packages) python;
mkFlag = trueStr: falseStr: cond: name: val:
if cond == null then null else
"--${if cond != false then trueStr else falseStr}${name}"
+ "${if val != null && cond != false then "=${val}" else ""}";
mkFlag = trueStr: falseStr: cond: name: val: "--"
+ (if cond then trueStr else falseStr)
+ name
+ optionalString (val != null && cond != false) "=${val}";
mkEnable = mkFlag "enable-" "disable-";
mkWith = mkFlag "with-" "without-";
mkOther = mkFlag "" "" true;