···158158 drv' = (lib.head outputsList).value;
159159 in lib.deepSeq drv' drv';
160160161161-162162- /* Tests whether a derivation can be used by the current platform
163163- Returns the derivation if true, otherwise null. */
164164- shouldUsePkgSystem = system: pkg_: let pkg = (builtins.tryEval pkg_).value;
165165- in if lib.any (x: x == system) (pkg.meta.platforms or [])
166166- then pkg
167167- else null;
168168-169169- /* Returns a configure flag string in an autotools format
170170- trueStr: Prepended when cond is true
171171- falseStr: Prepended when cond is false
172172- cond: The condition for the prepended string type and value
173173- name: The flag name
174174- val: The value of the flag only set when cond is true */
175175- mkFlag = trueStr: falseStr: cond: name: val:
176176- if cond == null then null else
177177- "--${if cond != false then trueStr else falseStr}${name}"
178178- + "${if val != null && cond != false then "=${val}" else ""}";
179179-180180- /* Flag setting helpers for autotools like packages */
181181- mkEnable = mkFlag "enable-" "disable-";
182182- mkWith = mkFlag "with-" "without-";
183183- mkOther = mkFlag "" "" true;
184161}
+49-44
pkgs/applications/virtualization/qemu/default.nix
···1717, type ? ""
1818}:
19192020-with stdenv;
2120with stdenv.lib;
2221let
2322 n = "qemu-2.3.0";
24232525- isKvmOnly = type == "kvm-only";
2626- isNix = type == "nix";
2424+ mkFlag = trueStr: falseStr: cond: name: val:
2525+ if cond == null then null else
2626+ "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
2727+ mkEnable = mkFlag "enable-" "disable-";
2828+ mkWith = mkFlag "with-" "without-";
2929+ mkOther = mkFlag "" "" true;
27302828- optSDL2 = if isNix then null else shouldUsePkg SDL2;
2929- optGtk = if isNix then null else shouldUsePkg gtk;
3030- optLibcap = if isNix then null else shouldUsePkg libcap;
3131- optAttr = if isNix then null else shouldUsePkg attr;
3232- optGnutls = if isNix then null else shouldUsePkg gnutls;
3333- optCyrus_sasl = if isNix then null else shouldUsePkg cyrus_sasl;
3434- optLibjpeg = if isNix then null else shouldUsePkg libjpeg;
3535- optLibpng = if isNix then null else shouldUsePkg libpng;
3636- optNcurses = if isNix then null else shouldUsePkg ncurses;
3737- optCurl = if isNix then null else shouldUsePkg curl;
3838- optBluez = if isNix then null else shouldUsePkg bluez;
3939- optLibibverbs = if isNix then null else shouldUsePkg libibverbs;
4040- optLibrdmacm = if isNix then null else shouldUsePkg librdmacm;
4141- optLibuuid = if isNix then null else shouldUsePkg libuuid;
4242- optVde2 = if isNix then null else shouldUsePkg vde2;
3131+ shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
3232+3333+ optSDL2 = if type == "nix" then null else shouldUsePkg SDL2;
3434+ optGtk = if type == "nix" then null else shouldUsePkg gtk;
3535+ optLibcap = if type == "nix" then null else shouldUsePkg libcap;
3636+ optAttr = if type == "nix" then null else shouldUsePkg attr;
3737+ optGnutls = if type == "nix" then null else shouldUsePkg gnutls;
3838+ optCyrus_sasl = if type == "nix" then null else shouldUsePkg cyrus_sasl;
3939+ optLibjpeg = if type == "nix" then null else shouldUsePkg libjpeg;
4040+ optLibpng = if type == "nix" then null else shouldUsePkg libpng;
4141+ optNcurses = if type == "nix" then null else shouldUsePkg ncurses;
4242+ optCurl = if type == "nix" then null else shouldUsePkg curl;
4343+ optBluez = if type == "nix" then null else shouldUsePkg bluez;
4444+ optLibibverbs = if type == "nix" then null else shouldUsePkg libibverbs;
4545+ optLibrdmacm = if type == "nix" then null else shouldUsePkg librdmacm;
4646+ optLibuuid = if type == "nix" then null else shouldUsePkg libuuid;
4747+ optVde2 = if type == "nix" then null else shouldUsePkg vde2;
4348 optLibaio = shouldUsePkg libaio;
4449 optLibcap_ng = shouldUsePkg libcap_ng;
4545- optSpice = if isNix then null else shouldUsePkg spice;
4646- optSpice_protocol = if isNix then null else shouldUsePkg spice_protocol;
4747- optLibceph = if isNix then null else shouldUsePkg libceph;
4848- optLibxfs = if isNix then null else shouldUsePkg libxfs;
4949- optNss = if isNix then null else shouldUsePkg nss;
5050- optNspr = if isNix then null else shouldUsePkg nspr;
5151- optLibusb = if isNix then null else shouldUsePkg libusb;
5252- optUsbredir = if isNix then null else shouldUsePkg usbredir;
5353- optMesa = if isNix then null else shouldUsePkg mesa;
5454- optLzo = if isNix then null else shouldUsePkg lzo;
5555- optSnappy = if isNix then null else shouldUsePkg snappy;
5656- optBzip2 = if isNix then null else shouldUsePkg bzip2;
5757- optLibseccomp = if isNix then null else shouldUsePkg libseccomp;
5858- optGlusterfs = if isNix then null else shouldUsePkg glusterfs;
5959- optLibssh2 = if isNix then null else shouldUsePkg libssh2;
6060- optNumactl = if isNix then null else shouldUsePkg numactl;
5050+ optSpice = if type == "nix" then null else shouldUsePkg spice;
5151+ optSpice_protocol = if type == "nix" then null else shouldUsePkg spice_protocol;
5252+ optLibceph = if type == "nix" then null else shouldUsePkg libceph;
5353+ optLibxfs = if type == "nix" then null else shouldUsePkg libxfs;
5454+ optNss = if type == "nix" then null else shouldUsePkg nss;
5555+ optNspr = if type == "nix" then null else shouldUsePkg nspr;
5656+ optLibusb = if type == "nix" then null else shouldUsePkg libusb;
5757+ optUsbredir = if type == "nix" then null else shouldUsePkg usbredir;
5858+ optMesa = if type == "nix" then null else shouldUsePkg mesa;
5959+ optLzo = if type == "nix" then null else shouldUsePkg lzo;
6060+ optSnappy = if type == "nix" then null else shouldUsePkg snappy;
6161+ optBzip2 = if type == "nix" then null else shouldUsePkg bzip2;
6262+ optLibseccomp = if type == "nix" then null else shouldUsePkg libseccomp;
6363+ optGlusterfs = if type == "nix" then null else shouldUsePkg glusterfs;
6464+ optLibssh2 = if type == "nix" then null else shouldUsePkg libssh2;
6565+ optNumactl = if type == "nix" then null else shouldUsePkg numactl;
61666267 hasSDLAbi = if optSDL2 != null then true else null;
63686469 hasVirtfs = stdenv.isLinux && optLibcap != null && optAttr != null;
65706666- hasVnc = !isNix;
7171+ hasVnc = type != "nix";
6772 hasVncTls = hasVnc && optGnutls != null;
6873 hasVncSasl = hasVnc && optCyrus_sasl != null;
6974 hasVncJpeg = hasVnc && optLibjpeg != null;
7075 hasVncPng = hasVnc && optLibpng != null;
7176 hasVncWs = hasVnc && optGnutls != null;
72777373- hasFdt = !isNix;
7878+ hasFdt = type != "nix";
74797580 hasRdma = optLibibverbs != null && optLibrdmacm != null;
7681···80858186 hasNss = optNss != null && optNspr != null;
82878383- optLibpulseaudio = if isNix then null else shouldUsePkg libpulseaudio;
8484- optAlsaLib = if isNix then null else shouldUsePkg alsaLib;
8888+ optLibpulseaudio = if type == "nix" then null else shouldUsePkg libpulseaudio;
8989+ optAlsaLib = if type == "nix" then null else shouldUsePkg alsaLib;
8590 audio = concatStringsSep "," (
8691 optional (optSDL2 != null) "sdl"
8792 ++ optional (optLibpulseaudio != null) "pa"
···164169 (mkEnable (optBluez != null) "bluez" null)
165170 (mkEnable stdenv.isLinux "kvm" null)
166171 (mkEnable hasRdma "rdma" null)
167167- (mkEnable (!isNix) "system" null)
168168- (mkEnable (!isKvmOnly) "user" null)
169169- (mkEnable (!isKvmOnly) "guest-base" null)
172172+ (mkEnable (type != "nix") "system" null)
173173+ (mkEnable (type != "kvm-only") "user" null)
174174+ (mkEnable (type != "kvm-only") "guest-base" null)
170175 (mkEnable true "pie" null)
171176 (mkEnable (optLibuuid != null) "uuid" null)
172177 (mkEnable (optVde2 != null) "vde" null)
···174179 (mkEnable hasLinuxAio "linux-aio" null)
175180 (mkEnable (optLibcap_ng != null) "cap-ng" null)
176181 (mkEnable (optAttr != null) "attr" null)
177177- (mkEnable (!isNix) "docs" null)
182182+ (mkEnable (type != "nix") "docs" null)
178183 (mkEnable stdenv.isLinux "vhost-net" null)
179184 (mkEnable hasSpice "spice" null)
180185 (mkEnable (optLibceph != null) "rbd" null)
···197202 (mkEnable (optLibuuid != null) "vhdx" null)
198203 (mkEnable (optGnutls != null) "quorum" null)
199204 (mkEnable (optNumactl != null) "numa" null)
200200- ] ++ optionals isKvmOnly [
205205+ ] ++ optionals (type == "kvm-only") [
201206 (mkOther "target-list" targetList)
202207 ];
203208···220225 description = "A generic and open source machine emulator and virtualizer";
221226 license = licenses.gpl2Plus;
222227 maintainers = with maintainers; [ viric shlevy eelco wkennington ];
223223- platforms = if isKvmOnly then platforms.linux else platforms.all;
228228+ platforms = if type == "kvm-only" then platforms.linux else platforms.all;
224229 };
225230}
+10-3
pkgs/development/libraries/kerberos/heimdal.nix
···88#, sqlite, db, ncurses, openssl, cyrus_sasl
99}:
10101111-with stdenv;
1212-with stdenv.lib;
1311let
1212+ mkFlag = trueStr: falseStr: cond: name: val:
1313+ if cond == null then null else
1414+ "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
1515+ mkEnable = mkFlag "enable-" "disable-";
1616+ mkWith = mkFlag "with-" "without-";
1717+ mkOther = mkFlag "" "" true;
1818+1919+ shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
2020+1421 optOpenldap = shouldUsePkg openldap;
1522 optLibcap_ng = shouldUsePkg libcap_ng;
1623 optSqlite = shouldUsePkg sqlite;
···9097 rmdir $out/libexec
9198 '';
92999393- meta = {
100100+ meta = with stdenv.lib; {
94101 description = "an implementation of Kerberos 5 (and some more stuff) largely written in Sweden";
95102 license = licenses.bsd3;
96103 platforms = platforms.linux;
+11-4
pkgs/development/libraries/libgcrypt/default.nix
···55, libcap ? null, pth ? null
66}:
7788-with stdenv;
99-with stdenv.lib;
108let
99+ mkFlag = trueStr: falseStr: cond: name: val:
1010+ if cond == null then null else
1111+ "--${if cond != false then trueStr else falseStr}${name}${if val != null && cond != false then "=${val}" else ""}";
1212+ mkEnable = mkFlag "enable-" "disable-";
1313+ mkWith = mkFlag "with-" "without-";
1414+ mkOther = mkFlag "" "" true;
1515+1616+ shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
1717+1118 optLibcap = shouldUsePkg libcap;
1219 #optPth = shouldUsePkg pth;
1320 optPth = null; # Broken as of 1.6.3
···3138 # Also make sure includes are fixed for callers who don't use libgpgcrypt-config
3239 postInstall = ''
3340 sed -i 's,#include <gpg-error.h>,#include "${libgpgerror}/include/gpg-error.h",g' $out/include/gcrypt.h
3434- '' + optionalString (!stdenv.isDarwin && optLibcap != null) ''
4141+ '' + stdenv.lib.optionalString (!stdenv.isDarwin && optLibcap != null) ''
3542 sed -i 's,\(-lcap\),-L${optLibcap}/lib \1,' $out/lib/libgcrypt.la
3643 '';
37443845 doCheck = true;
39464040- meta = {
4747+ meta = with stdenv.lib; {
4148 homepage = https://www.gnu.org/software/libgcrypt/;
4249 description = "General-pupose cryptographic library";
4350 license = licenses.lgpl2Plus;