From dde80d705e4b47e8ad7774037533e46ad1f7d53c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 9 Mar 2018 18:03:00 -0500 Subject: [PATCH 1/8] qtbase: Fix x86_64-conditional logic Now works with cross and old and new meta checks alike. --- pkgs/development/libraries/qt-5/modules/qtbase.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index 3a0a7326f762..c6473ff188a7 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -30,7 +30,6 @@ assert withGtk3 -> dconf != null; assert withGtk3 -> gtk3 != null; let - system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64; compareVersion = v: builtins.compareVersions version v; in @@ -258,7 +257,7 @@ stdenv.mkDerivation { "-no-warnings-are-errors" ] ++ ( - if (!system-x86_64) + if (!stdenv.hostPlatform.isx86_64) then [ "-no-sse2" ] else lib.optional (compareVersion "5.9.0" >= 0) [ "-sse2" ] ) From eeb8419c6a358a7b8d5a8fa9fc3d0352337196f7 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 9 Mar 2018 18:22:57 -0500 Subject: [PATCH 2/8] ceph: Fix --with-file-aio logic for new meta.platforms and cross --- pkgs/servers/http/nginx/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix index de30870bee83..ff0a4c65b4a6 100644 --- a/pkgs/servers/http/nginx/generic.nix +++ b/pkgs/servers/http/nginx/generic.nix @@ -55,7 +55,7 @@ stdenv.mkDerivation { "--with-mail_ssl_module" ] ++ optional (gd != null) "--with-http_image_filter_module" - ++ optional (elem stdenv.system (with platforms; linux ++ freebsd)) "--with-file-aio" + ++ optional (with stdenv.hostPlatform; isLinux || isFreeBSD) "--with-file-aio" ++ map (mod: "--add-module=${mod.src}") modules; NIX_CFLAGS_COMPILE = [ "-I${libxml2.dev}/include/libxml2" ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations"; From 79d8353b5e4bb98f1b51ab32b9b26df81bb7e106 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 9 Mar 2018 17:58:36 -0500 Subject: [PATCH 3/8] treewide: Make `shouldUsePackages` copypasta use meta.available The old way depended on old list-of-strings `meta.platforms`, and was not good for cross. --- 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, 6 insertions(+), 7 deletions(-) diff --git a/pkgs/development/libraries/wiredtiger/default.nix b/pkgs/development/libraries/wiredtiger/default.nix index 9d11b98b1cbd..c905c40cf960 100644 --- a/pkgs/development/libraries/wiredtiger/default.nix +++ b/pkgs/development/libraries/wiredtiger/default.nix @@ -15,7 +15,7 @@ let mkWith = mkFlag "with-" "without-"; mkOther = mkFlag "" "" true; - shouldUsePkg = pkg: if pkg != null && any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available 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 a242f0261c77..0ed0246a8813 100644 --- a/pkgs/misc/jackaudio/default.nix +++ b/pkgs/misc/jackaudio/default.nix @@ -15,7 +15,7 @@ with stdenv.lib; let inherit (python2Packages) python dbus-python; - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; libOnly = prefix == "lib"; diff --git a/pkgs/misc/jackaudio/jack1.nix b/pkgs/misc/jackaudio/jack1.nix index 28ce85bd8a3f..43d23dd525ae 100644 --- a/pkgs/misc/jackaudio/jack1.nix +++ b/pkgs/misc/jackaudio/jack1.nix @@ -5,7 +5,7 @@ }: let - shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available 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 4e2d2b388419..4e3e373d244c 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 && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; libOnly = prefix == "lib"; diff --git a/pkgs/servers/shishi/default.nix b/pkgs/servers/shishi/default.nix index 535571f46e20..1540a6f1fd18 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 && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; + shouldUsePkg = pkg: if pkg != null && pkg.meta.available 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 32b85eaa6815..3d35a10f3b3b 100644 --- a/pkgs/tools/filesystems/ceph/generic.nix +++ b/pkgs/tools/filesystems/ceph/generic.nix @@ -37,8 +37,7 @@ with stdenv.lib; let shouldUsePkg = pkg_: let pkg = (builtins.tryEval pkg_).value; - in if lib.any (x: x == system) (pkg.meta.platforms or []) - then pkg else null; + in if pkg.meta.available or false then pkg else null; optYasm = shouldUsePkg yasm; optFcgi = shouldUsePkg fcgi; From 59c656a42137e529cd77f7e42c559cef7c0e33f3 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 9 Mar 2018 18:31:42 -0500 Subject: [PATCH 4/8] dvdisaster: Fix sse2 logic for cross and improved `meta.platforms` --- pkgs/tools/cd-dvd/dvdisaster/default.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/tools/cd-dvd/dvdisaster/default.nix b/pkgs/tools/cd-dvd/dvdisaster/default.nix index e70d259df683..590c32188141 100644 --- a/pkgs/tools/cd-dvd/dvdisaster/default.nix +++ b/pkgs/tools/cd-dvd/dvdisaster/default.nix @@ -33,8 +33,7 @@ stdenv.mkDerivation rec { "--docdir=share/doc" "--with-nls=yes" "--with-embedded-src-path=no" - ] ++ stdenv.lib.optional (builtins.elem stdenv.system - stdenv.lib.platforms.x86_64) "--with-sse2=yes"; + ] ++ stdenv.lib.optional (stdenv.hostPlatform.isx86_64) "--with-sse2=yes"; # fatal error: inlined-icons.h: No such file or directory enableParallelBuilding = false; From 94cbd141203ca5007bc56236e24eeceae42778aa Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 9 Mar 2018 18:40:51 -0500 Subject: [PATCH 5/8] nethack: Fix platform logic --- pkgs/games/nethack/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix index d9ab3ee833b2..b67a79aa3fe7 100644 --- a/pkgs/games/nethack/default.nix +++ b/pkgs/games/nethack/default.nix @@ -2,11 +2,11 @@ let platform = - if lib.elem stdenv.system lib.platforms.unix then "unix" + if stdenv.hostPlatform.isUnix then "unix" else throw "Unknown platform for NetHack: ${stdenv.system}"; unixHint = - if stdenv.isLinux then "linux" - else if stdenv.isDarwin then "macosx10.10" + /**/ if stdenv.hostPlatform.isLinux then "linux" + else if stdenv.hostPlatform.isDarwin then "macosx10.10" # We probably want something different for Darwin else "unix"; userDir = "~/.config/nethack"; From c208ca638763ad7c0e5f4cc2e35016fff8ca1676 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 12 Mar 2018 18:37:17 -0400 Subject: [PATCH 6/8] robo3t: Simplify meta.platforms and don't refer to glibc directly --- pkgs/applications/misc/robo3t/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/misc/robo3t/default.nix b/pkgs/applications/misc/robo3t/default.nix index fc7ff4842394..8928ee18064d 100644 --- a/pkgs/applications/misc/robo3t/default.nix +++ b/pkgs/applications/misc/robo3t/default.nix @@ -58,7 +58,7 @@ stdenv.mkDerivation rec { mkdir -p $out/share/icons cp ${icon} $out/share/icons/robomongo.png - patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $BASEDIR/bin/robo3t + patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 $BASEDIR/bin/robo3t mkdir $out/bin @@ -70,7 +70,7 @@ stdenv.mkDerivation rec { meta = { homepage = https://robomongo.org/; description = "Query GUI for mongodb"; - platforms = stdenv.lib.intersectLists stdenv.lib.platforms.linux stdenv.lib.platforms.x86_64; + platforms = [ "x86_64-linux" ]; license = stdenv.lib.licenses.gpl3; maintainers = [ stdenv.lib.maintainers.eperuffo ]; }; From b152dcf852ecef3e30a632f0050abb30a26e1dfd Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 12 Mar 2018 15:18:25 -0400 Subject: [PATCH 7/8] pharo: Tighten source and simplify meta.platforms --- pkgs/development/pharo/vm/build-vm-legacy.nix | 8 ++++---- pkgs/development/pharo/wrapper/default.nix | 14 +++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/pkgs/development/pharo/vm/build-vm-legacy.nix b/pkgs/development/pharo/vm/build-vm-legacy.nix index 66cef77e5a94..f2fd6eebd56e 100644 --- a/pkgs/development/pharo/vm/build-vm-legacy.nix +++ b/pkgs/development/pharo/vm/build-vm-legacy.nix @@ -70,9 +70,9 @@ stdenv.mkDerivation rec { license = stdenv.lib.licenses.mit; maintainers = [ stdenv.lib.maintainers.lukego ]; # Pharo VM sources are packaged separately for darwin (OS X) - platforms = with stdenv.lib; - intersectLists - platforms.mesaPlatforms - (subtractLists platforms.darwin platforms.unix); + platforms = stdenv.lib.filter + (system: with stdenv.lib.systems.elaborate { inherit system; }; + isUnix && !isDarwin) + stdenv.lib.platforms.mesaPlatforms; }; } diff --git a/pkgs/development/pharo/wrapper/default.nix b/pkgs/development/pharo/wrapper/default.nix index f60b8a6d2038..084c46cd5b51 100644 --- a/pkgs/development/pharo/wrapper/default.nix +++ b/pkgs/development/pharo/wrapper/default.nix @@ -2,7 +2,7 @@ stdenv.mkDerivation rec { name = "pharo"; - src = ./.; + src = ./pharo-vm.sh; inherit cog32 spur32 spur64 file; magic = ./magic; desktopItem = makeDesktopItem { @@ -17,6 +17,10 @@ stdenv.mkDerivation rec { categories = "Development;"; mimeType = "application/x-pharo-image"; }; + unpackPhase = '' + cp $src ./pharo-vm.sh + sourceRoot=$PWD + ''; buildPhase = '' substituteAllInPlace ./pharo-vm.sh ''; @@ -49,10 +53,10 @@ stdenv.mkDerivation rec { license = stdenv.lib.licenses.mit; maintainers = [ stdenv.lib.maintainers.lukego ]; # Pharo VM sources are packaged separately for darwin (OS X) - platforms = with stdenv.lib; - intersectLists - platforms.mesaPlatforms - (subtractLists platforms.darwin platforms.unix); + platforms = stdenv.lib.filter + (system: with stdenv.lib.systems.elaborate { inherit system; }; + isUnix && !isDarwin) + stdenv.lib.platforms.mesaPlatforms; }; } From 2d1d83d836e09e50469302101955ea6c58dcd206 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 12 Mar 2018 18:30:50 -0400 Subject: [PATCH 8/8] pond: Simplify platform logic --- .../networking/instant-messengers/pond/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/pond/default.nix b/pkgs/applications/networking/instant-messengers/pond/default.nix index 002d0345a000..5d463648bd8b 100644 --- a/pkgs/applications/networking/instant-messengers/pond/default.nix +++ b/pkgs/applications/networking/instant-messengers/pond/default.nix @@ -2,7 +2,6 @@ fetchgit, fetchhg, fetchbzr, fetchsvn }: let - isx86_64 = stdenv.lib.any (n: n == stdenv.system) stdenv.lib.platforms.x86_64; gui = true; # Might be implemented with nixpkgs config. in buildGoPackage rec { @@ -22,11 +21,11 @@ buildGoPackage rec { nativeBuildInputs = [ pkgconfig ]; buildInputs = [ trousers gtk3 gtkspell3 ] - ++ stdenv.lib.optional isx86_64 dclxvi + ++ stdenv.lib.optional stdenv.hostPlatform.isx86_64 dclxvi ++ stdenv.lib.optionals gui [ wrapGAppsHook ]; buildFlags = stdenv.lib.optionalString (!gui) "-tags nogui"; excludedPackages = "\\(appengine\\|bn256cgo\\)"; - postPatch = stdenv.lib.optionalString isx86_64 '' + postPatch = stdenv.lib.optionalString stdenv.hostPlatform.isx86_64 '' grep -r 'bn256' | awk -F: '{print $1}' | xargs sed -i \ -e "s,golang.org/x/crypto/bn256,github.com/agl/pond/bn256cgo,g" \ -e "s,bn256\.,bn256cgo.,g"