shishi: replace mkFlag with lib.enableFeature and lib.withFeature

main
Pavol Rusnak 2 years ago
parent b912253a5d
commit 72848cc78e
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
  1. 34
      pkgs/servers/shishi/default.nix

@ -6,14 +6,6 @@
}:
let
mkFlag = trueStr: falseStr: cond: name: val: "--"
+ (if cond then trueStr else falseStr)
+ name
+ lib.optionalString (val != null && cond != false) "=${val}";
mkEnable = mkFlag "enable-" "disable-";
mkWith = mkFlag "with-" "without-";
mkOther = mkFlag "" "" true;
shouldUsePkg = pkg: if pkg != null && lib.meta.availableOn stdenv.hostPlatform pkg then pkg else null;
optPam = shouldUsePkg pam;
@ -37,19 +29,19 @@ stdenv.mkDerivation rec {
buildInputs = [ libgcrypt libgpg-error libtasn1 optPam optLibidn optGnutls ];
configureFlags = [
(mkOther "sysconfdir" "/etc")
(mkOther "localstatedir" "/var")
(mkEnable true "libgcrypt" null)
(mkEnable (optPam != null) "pam" null)
(mkEnable true "ipv6" null)
(mkWith (optLibidn != null) "stringprep" null)
(mkEnable (optGnutls != null) "starttls" null)
(mkEnable true "des" null)
(mkEnable true "3des" null)
(mkEnable true "aes" null)
(mkEnable true "md" null)
(mkEnable false "null" null)
(mkEnable true "arcfour" null)
"--sysconfdir=/etc"
"--localstatedir=/var"
(enableFeature true "libgcrypt")
(enableFeature (optPam != null) "pam")
(enableFeature true "ipv6")
(withFeature (optLibidn != null) "stringprep")
(enableFeature (optGnutls != null) "starttls")
(enableFeature true "des")
(enableFeature true "3des")
(enableFeature true "aes")
(enableFeature true "md")
(enableFeature false "null")
(enableFeature true "arcfour")
];
NIX_CFLAGS_COMPILE

Loading…
Cancel
Save