1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

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

This commit is contained in:
Pavol Rusnak 2022-06-29 21:53:52 +02:00
parent b912253a5d
commit 72848cc78e
No known key found for this signature in database
GPG key ID: 91F3B339B9A02A3D

View file

@ -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