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. --- pkgs/servers/shishi/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pkgs/servers/shishi/default.nix') diff --git a/pkgs/servers/shishi/default.nix b/pkgs/servers/shishi/default.nix index 3e340ba7df4..535571f46e2 100644 --- a/pkgs/servers/shishi/default.nix +++ b/pkgs/servers/shishi/default.nix @@ -6,9 +6,10 @@ }: let - 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 + + stdenv.lib.optionalString (val != null && cond != false) "=${val}"; mkEnable = mkFlag "enable-" "disable-"; mkWith = mkFlag "with-" "without-"; mkOther = mkFlag "" "" true; -- cgit 1.4.1