Unverified Commit 72848cc7 authored by Pavol Rusnak's avatar Pavol Rusnak
Browse files

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

parent b912253a
Loading
Loading
Loading
Loading
+13 −21
Original line number Diff line number Diff line
@@ -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