From c4c6df7f58e3876f48793d9930ec6a4dd2699671 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Mon, 3 Sep 2018 21:09:27 +0300 Subject: [PATCH 1/6] systemd: Replace meta.available checks This sort of code breaks config.{allowBroken, allowUnsupportedSystem} = true by making them do unpredictable things. --- pkgs/os-specific/linux/systemd/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix index 482e3e0bc796c..96c82a6d9f88c 100644 --- a/pkgs/os-specific/linux/systemd/default.nix +++ b/pkgs/os-specific/linux/systemd/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, intltool, gperf, libcap, kmod +{ stdenv, lib, fetchFromGitHub, fetchpatch, pkgconfig, intltool, gperf, libcap, kmod , xz, pam, acl, libuuid, m4, utillinux, libffi , glib, kbd, libxslt, coreutils, libgcrypt, libgpgerror, libidn2, libapparmor , audit, lz4, bzip2, libmicrohttpd, pcre2 @@ -10,8 +10,8 @@ , getent , buildPackages , withSelinux ? false, libselinux -, withLibseccomp ? libseccomp.meta.available, libseccomp -, withKexectools ? kexectools.meta.available, kexectools +, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp +, withKexectools ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) kexectools.meta.platforms, kexectools }: let From d159baac684b78126b3996610df9dd3b53ed0937 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Wed, 29 Aug 2018 01:20:22 +0300 Subject: [PATCH 2/6] nix: Replace meta.available checks This sort of code breaks config.{allowBroken, allowUnsupportedSystem} = true by making them do unpredictable things. --- pkgs/tools/package-management/nix/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix index ea0cdf9bd0f1a..71c5bd53909fd 100644 --- a/pkgs/tools/package-management/nix/default.nix +++ b/pkgs/tools/package-management/nix/default.nix @@ -5,7 +5,7 @@ , storeDir ? "/nix/store" , stateDir ? "/nix/var" , confDir ? "/etc" -, withLibseccomp ? libseccomp.meta.available, libseccomp +, withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp , withAWS ? stdenv.isLinux || stdenv.isDarwin, aws-sdk-cpp }: From d38a04b4ec60d6748887a194d9e533a71e0dee54 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Wed, 29 Aug 2018 01:20:43 +0300 Subject: [PATCH 3/6] apparmor: Replace meta.available checks This sort of code breaks config.{allowBroken, allowUnsupportedSystem} = true by making them do unpredictable things. --- pkgs/os-specific/linux/apparmor/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/apparmor/default.nix b/pkgs/os-specific/linux/apparmor/default.nix index 08428f95b06cf..3ffaef8109f31 100644 --- a/pkgs/os-specific/linux/apparmor/default.nix +++ b/pkgs/os-specific/linux/apparmor/default.nix @@ -1,10 +1,10 @@ -{ stdenv, fetchurl, fetchpatch, makeWrapper, autoreconfHook +{ stdenv, lib, fetchurl, fetchpatch, makeWrapper, autoreconfHook , pkgconfig, which , flex, bison , linuxHeaders ? stdenv.cc.libc.linuxHeaders , gawk -, withPerl ? stdenv.hostPlatform == stdenv.buildPlatform && perl.meta.available or false, perl -, withPython ? stdenv.hostPlatform == stdenv.buildPlatform && python.meta.available or false, python +, withPerl ? stdenv.hostPlatform == stdenv.buildPlatform && lib.any (lib.meta.platformMatch stdenv.hostPlatform) perl.meta.platforms, perl +, withPython ? stdenv.hostPlatform == stdenv.buildPlatform && lib.any (lib.meta.platformMatch stdenv.hostPlatform) python.meta.platforms, python , swig , ncurses , pam From 672034b140f10a9ed6c9834662b1df1d26c0431a Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Wed, 29 Aug 2018 01:20:54 +0300 Subject: [PATCH 4/6] treewide: Replace meta.available checks in `shouldUsePackages` copypasta This reverts commit 79d8353b5e4bb98f1b51ab32b9b26df81bb7e106. This sort of code breaks config.{allowBroken, allowUnsupportedSystem} = true by making them do unpredictable things. --- pkgs/development/libraries/wiredtiger/default.nix | 2 +- pkgs/misc/jackaudio/default.nix | 2 +- pkgs/misc/jackaudio/jack1.nix | 2 +- pkgs/os-specific/linux/ffado/default.nix | 2 +- pkgs/servers/shishi/default.nix | 2 +- pkgs/tools/filesystems/ceph/generic.nix | 3 ++- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/wiredtiger/default.nix b/pkgs/development/libraries/wiredtiger/default.nix index c4d94af850dd5..56068c435d807 100644 --- a/pkgs/development/libraries/wiredtiger/default.nix +++ b/pkgs/development/libraries/wiredtiger/default.nix @@ -14,7 +14,7 @@ let mkEnable = mkFlag "enable-" "disable-"; mkWith = mkFlag "with-" "without-"; - shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null; optLz4 = shouldUsePkg lz4; optSnappy = shouldUsePkg snappy; diff --git a/pkgs/misc/jackaudio/default.nix b/pkgs/misc/jackaudio/default.nix index 391ac107ab710..efd5aa4e9194f 100644 --- a/pkgs/misc/jackaudio/default.nix +++ b/pkgs/misc/jackaudio/default.nix @@ -14,7 +14,7 @@ with stdenv.lib; let inherit (python2Packages) python dbus-python; - shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null; libOnly = prefix == "lib"; diff --git a/pkgs/misc/jackaudio/jack1.nix b/pkgs/misc/jackaudio/jack1.nix index c11be4ad0c0ca..2e349cf691c9c 100644 --- a/pkgs/misc/jackaudio/jack1.nix +++ b/pkgs/misc/jackaudio/jack1.nix @@ -5,7 +5,7 @@ }: let - shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null; optAlsaLib = shouldUsePkg alsaLib; optDb = shouldUsePkg db; diff --git a/pkgs/os-specific/linux/ffado/default.nix b/pkgs/os-specific/linux/ffado/default.nix index 4e3e373d244c7..85218042cf764 100644 --- a/pkgs/os-specific/linux/ffado/default.nix +++ b/pkgs/os-specific/linux/ffado/default.nix @@ -11,7 +11,7 @@ let - shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null; libOnly = prefix == "lib"; diff --git a/pkgs/servers/shishi/default.nix b/pkgs/servers/shishi/default.nix index 1540a6f1fd18d..b066ff18bfdc8 100644 --- a/pkgs/servers/shishi/default.nix +++ b/pkgs/servers/shishi/default.nix @@ -14,7 +14,7 @@ let mkWith = mkFlag "with-" "without-"; mkOther = mkFlag "" "" true; - shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; + shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null; optPam = shouldUsePkg pam; optLibidn = shouldUsePkg libidn; diff --git a/pkgs/tools/filesystems/ceph/generic.nix b/pkgs/tools/filesystems/ceph/generic.nix index 14fedd6610e14..c4856d9252995 100644 --- a/pkgs/tools/filesystems/ceph/generic.nix +++ b/pkgs/tools/filesystems/ceph/generic.nix @@ -37,7 +37,8 @@ with stdenv.lib; let shouldUsePkg = pkg_: let pkg = (builtins.tryEval pkg_).value; - in if pkg.meta.available or false then pkg else null; + in if lib.any (lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms + then pkg else null; optYasm = shouldUsePkg yasm; optFcgi = shouldUsePkg fcgi; From 2cbde8479981e55823e839ab3c2ea8fa12816e8a Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Wed, 29 Aug 2018 01:21:05 +0300 Subject: [PATCH 5/6] ghc: Replace meta.available checks for enableIntegerSimple This sort of code breaks config.{allowBroken, allowUnsupportedSystem} = true by making them do unpredictable things. --- pkgs/development/compilers/ghc/7.10.3.nix | 2 +- pkgs/development/compilers/ghc/8.0.2.nix | 2 +- pkgs/development/compilers/ghc/8.2.2.nix | 2 +- pkgs/development/compilers/ghc/8.4.3.nix | 2 +- pkgs/development/compilers/ghc/8.6.1.nix | 2 +- pkgs/development/compilers/ghc/head.nix | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index a4374a4524027..b69ae80d0db5c 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -15,7 +15,7 @@ , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. - enableIntegerSimple ? !(gmp.meta.available or false), gmp + enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp , # If enabled, use -fPIC when compiling static libs. enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index 0946db7137836..f7422d150ac03 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -14,7 +14,7 @@ , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. - enableIntegerSimple ? !(gmp.meta.available or false), gmp + enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp , # If enabled, use -fPIC when compiling static libs. enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index 6a1914a9c2c8f..aac8cf4fd220e 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -15,7 +15,7 @@ , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. - enableIntegerSimple ? !(gmp.meta.available or false), gmp + enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp , # If enabled, use -fPIC when compiling static libs. enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform diff --git a/pkgs/development/compilers/ghc/8.4.3.nix b/pkgs/development/compilers/ghc/8.4.3.nix index 8fba60d527fd8..e43f9a57d0a45 100644 --- a/pkgs/development/compilers/ghc/8.4.3.nix +++ b/pkgs/development/compilers/ghc/8.4.3.nix @@ -14,7 +14,7 @@ , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. - enableIntegerSimple ? !(gmp.meta.available or false), gmp + enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp , # If enabled, use -fPIC when compiling static libs. enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform diff --git a/pkgs/development/compilers/ghc/8.6.1.nix b/pkgs/development/compilers/ghc/8.6.1.nix index c12401f05778d..62ea39791b908 100644 --- a/pkgs/development/compilers/ghc/8.6.1.nix +++ b/pkgs/development/compilers/ghc/8.6.1.nix @@ -14,7 +14,7 @@ , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. - enableIntegerSimple ? !(gmp.meta.available or false), gmp + enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp , # If enabled, use -fPIC when compiling static libs. enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index af5efbd7df8ce..87045815a37f3 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -14,7 +14,7 @@ , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. - enableIntegerSimple ? !(gmp.meta.available or false), gmp + enableIntegerSimple ? !(stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) gmp.meta.platforms), gmp , # If enabled, use -fPIC when compiling static libs. enableRelocatedStaticLibs ? stdenv.targetPlatform != stdenv.hostPlatform From 2666fb018e2445218c005f07ea3ded73600a4e44 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Wed, 29 Aug 2018 01:21:33 +0300 Subject: [PATCH 6/6] nixos/kexec: Replace meta.available checks This sort of code breaks config.{allowBroken, allowUnsupportedSystem} = true by making them do unpredictable things. --- nixos/modules/system/boot/kexec.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/system/boot/kexec.nix b/nixos/modules/system/boot/kexec.nix index 3e5d7b40f2c58..b95673d825b32 100644 --- a/nixos/modules/system/boot/kexec.nix +++ b/nixos/modules/system/boot/kexec.nix @@ -1,7 +1,7 @@ { pkgs, lib, ... }: { - config = lib.mkIf (pkgs.kexectools.meta.available) { + config = lib.mkIf (lib.any (lib.meta.platformMatch pkgs.stdenv.hostPlatform) pkgs.kexectools.meta.platform) { environment.systemPackages = [ pkgs.kexectools ]; systemd.services."prepare-kexec" =