Revert "Refactor mkFlag / shouldUsePkg into the nixpkgs libraries"

This reverts commit 25a148fa196b944b3f134527da87e43d88c066f9.

+176 -104
-23
lib/customisation.nix
··· 158 158 drv' = (lib.head outputsList).value; 159 159 in lib.deepSeq drv' drv'; 160 160 161 - 162 - /* Tests whether a derivation can be used by the current platform 163 - Returns the derivation if true, otherwise null. */ 164 - shouldUsePkgSystem = system: pkg_: let pkg = (builtins.tryEval pkg_).value; 165 - in if lib.any (x: x == system) (pkg.meta.platforms or []) 166 - then pkg 167 - else null; 168 - 169 - /* Returns a configure flag string in an autotools format 170 - trueStr: Prepended when cond is true 171 - falseStr: Prepended when cond is false 172 - cond: The condition for the prepended string type and value 173 - name: The flag name 174 - val: The value of the flag only set when cond is true */ 175 - mkFlag = trueStr: falseStr: cond: name: val: 176 - if cond == null then null else 177 - "--${if cond != false then trueStr else falseStr}${name}" 178 - + "${if val != null && cond != false then "=${val}" else ""}"; 179 - 180 - /* Flag setting helpers for autotools like packages */ 181 - mkEnable = mkFlag "enable-" "disable-"; 182 - mkWith = mkFlag "with-" "without-"; 183 - mkOther = mkFlag "" "" true; 184 161 }
+49 -44
pkgs/applications/virtualization/qemu/default.nix
··· 17 17 , type ? "" 18 18 }: 19 19 20 - with stdenv; 21 20 with stdenv.lib; 22 21 let 23 22 n = "qemu-2.3.0"; 24 23 25 - isKvmOnly = type == "kvm-only"; 26 - isNix = type == "nix"; 24 + mkFlag = trueStr: falseStr: cond: name: val: 25 + if cond == null then null else 26 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 27 + mkEnable = mkFlag "enable-" "disable-"; 28 + mkWith = mkFlag "with-" "without-"; 29 + mkOther = mkFlag "" "" true; 27 30 28 - optSDL2 = if isNix then null else shouldUsePkg SDL2; 29 - optGtk = if isNix then null else shouldUsePkg gtk; 30 - optLibcap = if isNix then null else shouldUsePkg libcap; 31 - optAttr = if isNix then null else shouldUsePkg attr; 32 - optGnutls = if isNix then null else shouldUsePkg gnutls; 33 - optCyrus_sasl = if isNix then null else shouldUsePkg cyrus_sasl; 34 - optLibjpeg = if isNix then null else shouldUsePkg libjpeg; 35 - optLibpng = if isNix then null else shouldUsePkg libpng; 36 - optNcurses = if isNix then null else shouldUsePkg ncurses; 37 - optCurl = if isNix then null else shouldUsePkg curl; 38 - optBluez = if isNix then null else shouldUsePkg bluez; 39 - optLibibverbs = if isNix then null else shouldUsePkg libibverbs; 40 - optLibrdmacm = if isNix then null else shouldUsePkg librdmacm; 41 - optLibuuid = if isNix then null else shouldUsePkg libuuid; 42 - optVde2 = if isNix then null else shouldUsePkg vde2; 31 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 32 + 33 + optSDL2 = if type == "nix" then null else shouldUsePkg SDL2; 34 + optGtk = if type == "nix" then null else shouldUsePkg gtk; 35 + optLibcap = if type == "nix" then null else shouldUsePkg libcap; 36 + optAttr = if type == "nix" then null else shouldUsePkg attr; 37 + optGnutls = if type == "nix" then null else shouldUsePkg gnutls; 38 + optCyrus_sasl = if type == "nix" then null else shouldUsePkg cyrus_sasl; 39 + optLibjpeg = if type == "nix" then null else shouldUsePkg libjpeg; 40 + optLibpng = if type == "nix" then null else shouldUsePkg libpng; 41 + optNcurses = if type == "nix" then null else shouldUsePkg ncurses; 42 + optCurl = if type == "nix" then null else shouldUsePkg curl; 43 + optBluez = if type == "nix" then null else shouldUsePkg bluez; 44 + optLibibverbs = if type == "nix" then null else shouldUsePkg libibverbs; 45 + optLibrdmacm = if type == "nix" then null else shouldUsePkg librdmacm; 46 + optLibuuid = if type == "nix" then null else shouldUsePkg libuuid; 47 + optVde2 = if type == "nix" then null else shouldUsePkg vde2; 43 48 optLibaio = shouldUsePkg libaio; 44 49 optLibcap_ng = shouldUsePkg libcap_ng; 45 - optSpice = if isNix then null else shouldUsePkg spice; 46 - optSpice_protocol = if isNix then null else shouldUsePkg spice_protocol; 47 - optLibceph = if isNix then null else shouldUsePkg libceph; 48 - optLibxfs = if isNix then null else shouldUsePkg libxfs; 49 - optNss = if isNix then null else shouldUsePkg nss; 50 - optNspr = if isNix then null else shouldUsePkg nspr; 51 - optLibusb = if isNix then null else shouldUsePkg libusb; 52 - optUsbredir = if isNix then null else shouldUsePkg usbredir; 53 - optMesa = if isNix then null else shouldUsePkg mesa; 54 - optLzo = if isNix then null else shouldUsePkg lzo; 55 - optSnappy = if isNix then null else shouldUsePkg snappy; 56 - optBzip2 = if isNix then null else shouldUsePkg bzip2; 57 - optLibseccomp = if isNix then null else shouldUsePkg libseccomp; 58 - optGlusterfs = if isNix then null else shouldUsePkg glusterfs; 59 - optLibssh2 = if isNix then null else shouldUsePkg libssh2; 60 - optNumactl = if isNix then null else shouldUsePkg numactl; 50 + optSpice = if type == "nix" then null else shouldUsePkg spice; 51 + optSpice_protocol = if type == "nix" then null else shouldUsePkg spice_protocol; 52 + optLibceph = if type == "nix" then null else shouldUsePkg libceph; 53 + optLibxfs = if type == "nix" then null else shouldUsePkg libxfs; 54 + optNss = if type == "nix" then null else shouldUsePkg nss; 55 + optNspr = if type == "nix" then null else shouldUsePkg nspr; 56 + optLibusb = if type == "nix" then null else shouldUsePkg libusb; 57 + optUsbredir = if type == "nix" then null else shouldUsePkg usbredir; 58 + optMesa = if type == "nix" then null else shouldUsePkg mesa; 59 + optLzo = if type == "nix" then null else shouldUsePkg lzo; 60 + optSnappy = if type == "nix" then null else shouldUsePkg snappy; 61 + optBzip2 = if type == "nix" then null else shouldUsePkg bzip2; 62 + optLibseccomp = if type == "nix" then null else shouldUsePkg libseccomp; 63 + optGlusterfs = if type == "nix" then null else shouldUsePkg glusterfs; 64 + optLibssh2 = if type == "nix" then null else shouldUsePkg libssh2; 65 + optNumactl = if type == "nix" then null else shouldUsePkg numactl; 61 66 62 67 hasSDLAbi = if optSDL2 != null then true else null; 63 68 64 69 hasVirtfs = stdenv.isLinux && optLibcap != null && optAttr != null; 65 70 66 - hasVnc = !isNix; 71 + hasVnc = type != "nix"; 67 72 hasVncTls = hasVnc && optGnutls != null; 68 73 hasVncSasl = hasVnc && optCyrus_sasl != null; 69 74 hasVncJpeg = hasVnc && optLibjpeg != null; 70 75 hasVncPng = hasVnc && optLibpng != null; 71 76 hasVncWs = hasVnc && optGnutls != null; 72 77 73 - hasFdt = !isNix; 78 + hasFdt = type != "nix"; 74 79 75 80 hasRdma = optLibibverbs != null && optLibrdmacm != null; 76 81 ··· 80 85 81 86 hasNss = optNss != null && optNspr != null; 82 87 83 - optLibpulseaudio = if isNix then null else shouldUsePkg libpulseaudio; 84 - optAlsaLib = if isNix then null else shouldUsePkg alsaLib; 88 + optLibpulseaudio = if type == "nix" then null else shouldUsePkg libpulseaudio; 89 + optAlsaLib = if type == "nix" then null else shouldUsePkg alsaLib; 85 90 audio = concatStringsSep "," ( 86 91 optional (optSDL2 != null) "sdl" 87 92 ++ optional (optLibpulseaudio != null) "pa" ··· 164 169 (mkEnable (optBluez != null) "bluez" null) 165 170 (mkEnable stdenv.isLinux "kvm" null) 166 171 (mkEnable hasRdma "rdma" null) 167 - (mkEnable (!isNix) "system" null) 168 - (mkEnable (!isKvmOnly) "user" null) 169 - (mkEnable (!isKvmOnly) "guest-base" null) 172 + (mkEnable (type != "nix") "system" null) 173 + (mkEnable (type != "kvm-only") "user" null) 174 + (mkEnable (type != "kvm-only") "guest-base" null) 170 175 (mkEnable true "pie" null) 171 176 (mkEnable (optLibuuid != null) "uuid" null) 172 177 (mkEnable (optVde2 != null) "vde" null) ··· 174 179 (mkEnable hasLinuxAio "linux-aio" null) 175 180 (mkEnable (optLibcap_ng != null) "cap-ng" null) 176 181 (mkEnable (optAttr != null) "attr" null) 177 - (mkEnable (!isNix) "docs" null) 182 + (mkEnable (type != "nix") "docs" null) 178 183 (mkEnable stdenv.isLinux "vhost-net" null) 179 184 (mkEnable hasSpice "spice" null) 180 185 (mkEnable (optLibceph != null) "rbd" null) ··· 197 202 (mkEnable (optLibuuid != null) "vhdx" null) 198 203 (mkEnable (optGnutls != null) "quorum" null) 199 204 (mkEnable (optNumactl != null) "numa" null) 200 - ] ++ optionals isKvmOnly [ 205 + ] ++ optionals (type == "kvm-only") [ 201 206 (mkOther "target-list" targetList) 202 207 ]; 203 208 ··· 220 225 description = "A generic and open source machine emulator and virtualizer"; 221 226 license = licenses.gpl2Plus; 222 227 maintainers = with maintainers; [ viric shlevy eelco wkennington ]; 223 - platforms = if isKvmOnly then platforms.linux else platforms.all; 228 + platforms = if type == "kvm-only" then platforms.linux else platforms.all; 224 229 }; 225 230 }
+10 -3
pkgs/development/libraries/kerberos/heimdal.nix
··· 8 8 #, sqlite, db, ncurses, openssl, cyrus_sasl 9 9 }: 10 10 11 - with stdenv; 12 - with stdenv.lib; 13 11 let 12 + mkFlag = trueStr: falseStr: cond: name: val: 13 + if cond == null then null else 14 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 15 + mkEnable = mkFlag "enable-" "disable-"; 16 + mkWith = mkFlag "with-" "without-"; 17 + mkOther = mkFlag "" "" true; 18 + 19 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 20 + 14 21 optOpenldap = shouldUsePkg openldap; 15 22 optLibcap_ng = shouldUsePkg libcap_ng; 16 23 optSqlite = shouldUsePkg sqlite; ··· 90 97 rmdir $out/libexec 91 98 ''; 92 99 93 - meta = { 100 + meta = with stdenv.lib; { 94 101 description = "an implementation of Kerberos 5 (and some more stuff) largely written in Sweden"; 95 102 license = licenses.bsd3; 96 103 platforms = platforms.linux;
+11 -4
pkgs/development/libraries/libgcrypt/default.nix
··· 5 5 , libcap ? null, pth ? null 6 6 }: 7 7 8 - with stdenv; 9 - with stdenv.lib; 10 8 let 9 + mkFlag = trueStr: falseStr: cond: name: val: 10 + if cond == null then null else 11 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 12 + mkEnable = mkFlag "enable-" "disable-"; 13 + mkWith = mkFlag "with-" "without-"; 14 + mkOther = mkFlag "" "" true; 15 + 16 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 17 + 11 18 optLibcap = shouldUsePkg libcap; 12 19 #optPth = shouldUsePkg pth; 13 20 optPth = null; # Broken as of 1.6.3 ··· 31 38 # Also make sure includes are fixed for callers who don't use libgpgcrypt-config 32 39 postInstall = '' 33 40 sed -i 's,#include <gpg-error.h>,#include "${libgpgerror}/include/gpg-error.h",g' $out/include/gcrypt.h 34 - '' + optionalString (!stdenv.isDarwin && optLibcap != null) '' 41 + '' + stdenv.lib.optionalString (!stdenv.isDarwin && optLibcap != null) '' 35 42 sed -i 's,\(-lcap\),-L${optLibcap}/lib \1,' $out/lib/libgcrypt.la 36 43 ''; 37 44 38 45 doCheck = true; 39 46 40 - meta = { 47 + meta = with stdenv.lib; { 41 48 homepage = https://www.gnu.org/software/libgcrypt/; 42 49 description = "General-pupose cryptographic library"; 43 50 license = licenses.lgpl2Plus;
+9 -1
pkgs/development/libraries/libmicrohttpd/default.nix
··· 5 5 , openssl ? null, zlib ? null, libgcrypt ? null, gnutls ? null 6 6 }: 7 7 8 - with stdenv; 9 8 let 9 + mkFlag = trueStr: falseStr: cond: name: val: 10 + if cond == null then null else 11 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 12 + mkEnable = mkFlag "enable-" "disable-"; 13 + mkWith = mkFlag "with-" "without-"; 14 + mkOther = mkFlag "" "" true; 15 + 16 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 17 + 10 18 optOpenssl = shouldUsePkg openssl; 11 19 optZlib = shouldUsePkg zlib; 12 20 hasSpdy = optOpenssl != null && optZlib != null;
+2 -1
pkgs/development/libraries/libssh/default.nix
··· 7 7 , openssl ? null, libgcrypt ? null 8 8 }: 9 9 10 - with stdenv; 11 10 let 11 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 12 + 12 13 # Prefer openssl 13 14 cryptoStr = if shouldUsePkg openssl != null then "openssl" 14 15 else if shouldUsePkg libgcrypt != null then "libgcrypt"
+9 -1
pkgs/development/libraries/libssh2/default.nix
··· 7 7 , openssl ? null, libgcrypt ? null 8 8 }: 9 9 10 - with stdenv; 11 10 let 11 + mkFlag = trueStr: falseStr: cond: name: val: 12 + if cond == null then null else 13 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 14 + mkEnable = mkFlag "enable-" "disable-"; 15 + mkWith = mkFlag "with-" "without-"; 16 + mkOther = mkFlag "" "" true; 17 + 18 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 19 + 12 20 # Prefer openssl 13 21 cryptoStr = if shouldUsePkg openssl != null then "openssl" 14 22 else if shouldUsePkg libgcrypt != null then "libgcrypt"
+9 -2
pkgs/development/libraries/libxml2/default.nix
··· 6 6 7 7 #TODO: share most stuff between python and non-python builds, perhaps via multiple-output 8 8 9 - with stdenv; 10 9 let 10 + mkFlag = trueStr: falseStr: cond: name: val: 11 + if cond == null then null else 12 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 13 + mkEnable = mkFlag "enable-" "disable-"; 14 + mkWith = mkFlag "with-" "without-"; 15 + mkOther = mkFlag "" "" true; 16 + 17 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 18 + 11 19 optIcu = shouldUsePkg icu; 12 20 optPython = shouldUsePkg python; 13 21 optReadline = shouldUsePkg readline; ··· 17 25 sitePackages = if optPython == null then null else 18 26 "\${out}/lib/${python.libPrefix}/site-packages"; 19 27 in 20 - with stdenv.lib; 21 28 stdenv.mkDerivation rec { 22 29 name = "libxml2-${version}"; 23 30 version = "2.9.2";
+15 -3
pkgs/development/libraries/ncurses/default.nix
··· 8 8 , unicode ? true 9 9 }: 10 10 11 - with stdenv.lib; 12 11 let 12 + mkFlag = trueStr: falseStr: cond: name: val: 13 + if cond == null then null else 14 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 15 + mkEnable = mkFlag "enable-" "disable-"; 16 + mkWith = mkFlag "with-" "without-"; 17 + mkOther = mkFlag "" "" true; 18 + 19 + shouldUsePkg = pkg_: let 20 + pkg = (builtins.tryEval pkg_).value; 21 + in if stdenv.lib.any (x: x == stdenv.system) (pkg.meta.platforms or []) 22 + then pkg 23 + else null; 24 + 13 25 buildShared = !stdenv.isDarwin; 14 26 15 - optGpm = stdenv.shouldUsePkg gpm; 27 + optGpm = shouldUsePkg gpm; 16 28 in 17 29 stdenv.mkDerivation rec { 18 30 name = "ncurses-5.9"; ··· 124 136 ln -svf libncurses.so $out/lib/libcurses.so 125 137 ''; 126 138 127 - meta = { 139 + meta = with stdenv.lib; { 128 140 description = "Free software emulation of curses in SVR4 and more"; 129 141 130 142 longDescription = ''
+11 -4
pkgs/development/libraries/nghttp2/default.nix
··· 8 8 , prefix ? "" 9 9 }: 10 10 11 - with stdenv; 12 - with stdenv.lib; 13 11 let 12 + mkFlag = trueStr: falseStr: cond: name: val: 13 + if cond == null then null else 14 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 15 + mkEnable = mkFlag "enable-" "disable-"; 16 + mkWith = mkFlag "with-" "without-"; 17 + mkOther = mkFlag "" "" true; 18 + 19 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 20 + 14 21 isLib = prefix == "lib"; 15 22 16 23 optOpenssl = if isLib then null else shouldUsePkg openssl; ··· 43 50 44 51 nativeBuildInputs = [ pkgconfig ]; 45 52 buildInputs = [ optJansson optBoost optLibxml2 optJemalloc ] 46 - ++ optionals hasApp [ optOpenssl optLibev optZlib ]; 53 + ++ stdenv.lib.optionals hasApp [ optOpenssl optLibev optZlib ]; 47 54 48 55 configureFlags = [ 49 56 (mkEnable false "werror" null) ··· 61 68 (mkWith false "cython" null) 62 69 ]; 63 70 64 - meta = { 71 + meta = with stdenv.lib; { 65 72 homepage = http://nghttp2.org/; 66 73 description = "an implementation of HTTP/2 in C"; 67 74 license = licenses.mit;
+10 -2
pkgs/development/libraries/wiredtiger/default.nix
··· 5 5 , gperftools ? null, leveldb ? null 6 6 }: 7 7 8 - with stdenv; 8 + with stdenv.lib; 9 9 let 10 + mkFlag = trueStr: falseStr: cond: name: val: 11 + if cond == null then null else 12 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 13 + mkEnable = mkFlag "enable-" "disable-"; 14 + mkWith = mkFlag "with-" "without-"; 15 + mkOther = mkFlag "" "" true; 16 + 17 + shouldUsePkg = pkg: if pkg != null && any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 18 + 10 19 optLz4 = shouldUsePkg lz4; 11 20 optSnappy = shouldUsePkg snappy; 12 21 optZlib = shouldUsePkg zlib; ··· 15 24 optGperftools = shouldUsePkg gperftools; 16 25 optLeveldb = shouldUsePkg leveldb; 17 26 in 18 - with stdenv.lib; 19 27 stdenv.mkDerivation rec { 20 28 name = "wiredtiger-${version}"; 21 29 version = "2.6.0";
+2 -1
pkgs/misc/jackaudio/default.nix
··· 9 9 , prefix ? "" 10 10 }: 11 11 12 - with stdenv; 13 12 with stdenv.lib; 14 13 let 14 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 15 + 15 16 libOnly = prefix == "lib"; 16 17 17 18 optDbus = shouldUsePkg dbus;
+2 -1
pkgs/misc/jackaudio/jack1.nix
··· 4 4 , alsaLib ? null, db ? null, libuuid ? null, libffado ? null, celt ? null 5 5 }: 6 6 7 - with stdenv; 8 7 let 8 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 9 + 9 10 optAlsaLib = shouldUsePkg alsaLib; 10 11 optDb = shouldUsePkg db; 11 12 optLibuuid = shouldUsePkg libuuid;
+3 -1
pkgs/os-specific/linux/ffado/default.nix
··· 9 9 , prefix ? "" 10 10 }: 11 11 12 - with stdenv; 13 12 let 13 + 14 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 15 + 14 16 libOnly = prefix == "lib"; 15 17 16 18 optLibjack2 = shouldUsePkg libjack2;
+14 -7
pkgs/servers/pulseaudio/default.nix
··· 15 15 , prefix ? "" 16 16 }: 17 17 18 - with stdenv; 19 18 let 19 + mkFlag = trueStr: falseStr: cond: name: val: 20 + if cond == null then null else 21 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 22 + mkEnable = mkFlag "enable-" "disable-"; 23 + mkWith = mkFlag "with-" "without-"; 24 + mkOther = mkFlag "" "" true; 25 + 26 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 27 + 20 28 libOnly = prefix == "lib"; 21 29 22 30 hasXlibs = xlibs != null; ··· 58 66 simple = null; 59 67 }.${databaseName}; 60 68 in 61 - with stdenv.lib; 62 69 stdenv.mkDerivation rec { 63 70 name = "${prefix}pulseaudio-${version}"; 64 71 version = "6.0"; ··· 77 84 optLibcap valgrind optOss optCoreaudio optAlsaLib optEsound optGlib 78 85 optGtk3 optGconf optAvahi optLibjack2 optLibasyncns optLirc optDbus optUdev 79 86 optOpenssl optFftw optSpeexdsp optSystemd optWebrtc-audio-processing 80 - ] ++ optionals hasXlibs (with xlibs; [ 87 + ] ++ stdenv.lib.optionals hasXlibs (with xlibs; [ 81 88 libX11 libxcb libICE libSM libXtst xextproto libXi 82 - ]) ++ optionals (optBluez5 != null) [ optBluez5 optSbc ]; 89 + ]) ++ stdenv.lib.optionals (optBluez5 != null) [ optBluez5 optSbc ]; 83 90 84 91 preConfigure = '' 85 92 # Performs and autoreconf ··· 155 162 # the alternative is to copy the files from /usr/include to src, but there are 156 163 # probably a large number of files that would need to be copied (I stopped 157 164 # after the seventh) 158 - NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin 165 + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin 159 166 "-I/usr/include"; 160 167 161 168 installFlags = [ ··· 163 170 "pulseconfdir=$(out)/etc/pulse" 164 171 ]; 165 172 166 - postInstall = optionalString libOnly '' 173 + postInstall = stdenv.lib.optionalString libOnly '' 167 174 rm -rf $out/{bin,share,etc,lib/{pulse-*,systemd}} 168 175 ''; 169 176 170 - meta = { 177 + meta = with stdenv.lib; { 171 178 description = "Sound server for POSIX and Win32 systems"; 172 179 homepage = http://www.pulseaudio.org/; 173 180 # Note: Practically, the server is under the GPL due to the
+9 -1
pkgs/servers/shishi/default.nix
··· 5 5 , pam ? null, libidn ? null, gnutls ? null 6 6 }: 7 7 8 - with stdenv; 9 8 let 9 + mkFlag = trueStr: falseStr: cond: name: val: 10 + if cond == null then null else 11 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 12 + mkEnable = mkFlag "enable-" "disable-"; 13 + mkWith = mkFlag "with-" "without-"; 14 + mkOther = mkFlag "" "" true; 15 + 16 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 17 + 10 18 optPam = shouldUsePkg pam; 11 19 optLibidn = shouldUsePkg libidn; 12 20 optGnutls = shouldUsePkg gnutls;
-2
pkgs/stdenv/generic/default.nix
··· 232 232 || system == "armv7l-linux"; 233 233 isBigEndian = system == "powerpc-linux"; 234 234 235 - shouldUsePkg = lib.shouldUsePkgSystem system; 236 - 237 235 # Whether we should run paxctl to pax-mark binaries. 238 236 needsPax = isLinux; 239 237
+11 -3
pkgs/tools/networking/curl/default.nix
··· 8 8 , suffix ? "" 9 9 }: 10 10 11 - with stdenv; 12 - with stdenv.lib; 13 11 let 12 + mkFlag = trueStr: falseStr: cond: name: val: 13 + if cond == null then null else 14 + "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}"; 15 + mkEnable = mkFlag "enable-" "disable-"; 16 + mkWith = mkFlag "with-" "without-"; 17 + mkOther = mkFlag "" "" true; 18 + 19 + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 20 + 14 21 isLight = suffix == "light"; 15 22 isFull = suffix == "full"; 16 - nameSuffix = optionalString (suffix != "") "-${suffix}"; 23 + nameSuffix = stdenv.lib.optionalString (suffix != "") "-${suffix}"; 17 24 18 25 # Normal Depedencies 19 26 optZlib = if isLight then null else shouldUsePkg zlib; ··· 28 35 optOpenldap = if !isFull then null else shouldUsePkg openldap; 29 36 optLibidn = if !isFull then null else shouldUsePkg libidn; 30 37 in 38 + with stdenv.lib; 31 39 stdenv.mkDerivation rec { 32 40 name = "curl${nameSuffix}-${version}"; 33 41 version = "7.42.1";