diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-04-01 15:50:50 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-04-01 15:50:50 +0000 |
commit | 75eafe97f7df0d653bec67f3962214d7c357831f (patch) | |
tree | 09f2cc901e0e637876cbb78d192dfe2fcfef8156 /nixpkgs/pkgs/tools/package-management/nix/default.nix | |
parent | a53b121bf4331497da63df3b1b7f1a7897dad146 (diff) | |
parent | a2e06fc3423c4be53181b15c28dfbe0bcf67dd73 (diff) | |
download | nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.gz nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.bz2 nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.lz nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.xz nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.zst nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.zip |
Merge commit 'a2e06fc3423c4be53181b15c28dfbe0bcf67dd73'
Diffstat (limited to 'nixpkgs/pkgs/tools/package-management/nix/default.nix')
-rw-r--r-- | nixpkgs/pkgs/tools/package-management/nix/default.nix | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/nixpkgs/pkgs/tools/package-management/nix/default.nix b/nixpkgs/pkgs/tools/package-management/nix/default.nix index 28413971c004..29af4a90cb90 100644 --- a/nixpkgs/pkgs/tools/package-management/nix/default.nix +++ b/nixpkgs/pkgs/tools/package-management/nix/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchurl, fetchFromGitHub, callPackage +{ lib, fetchurl, callPackage , storeDir ? "/nix/store" , stateDir ? "/nix/var" , confDir ? "/etc" @@ -10,8 +10,9 @@ let common = { lib, stdenv, fetchpatch, perl, curl, bzip2, sqlite, openssl ? null, xz + , bash, coreutils, gzip, gnutar , pkgconfig, boehmgc, perlPackages, libsodium, brotli, boost, editline, nlohmann_json - , autoreconfHook, autoconf-archive, bison, flex, libxml2, libxslt, docbook5, docbook_xsl_ns, jq + , jq, libarchive, rustc, cargo , busybox-sandbox-shell , storeDir , stateDir @@ -19,7 +20,7 @@ common = , withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp , withAWS ? stdenv.isLinux || stdenv.isDarwin, aws-sdk-cpp - , name, suffix ? "", src, includesPerl ? false, fromGit ? false + , name, suffix ? "", src, includesPerl ? false }: let @@ -29,19 +30,22 @@ common = version = lib.getVersion name; is20 = lib.versionAtLeast version "2.0pre"; + is24 = lib.versionAtLeast version "2.4pre"; + isExactly23 = lib.versionAtLeast version "2.3" && lib.versionOlder version "2.4"; - VERSION_SUFFIX = lib.optionalString fromGit suffix; + VERSION_SUFFIX = suffix; outputs = [ "out" "dev" "man" "doc" ]; nativeBuildInputs = [ pkgconfig ] ++ lib.optionals (!is20) [ curl perl ] - ++ lib.optionals fromGit [ autoreconfHook autoconf-archive bison flex libxml2 libxslt docbook5 docbook_xsl_ns jq ]; + ++ lib.optionals is24 [ jq ]; buildInputs = [ curl openssl sqlite xz bzip2 nlohmann_json ] ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium ++ lib.optionals is20 [ brotli boost editline ] + ++ lib.optionals is24 [ libarchive rustc cargo ] ++ lib.optional withLibseccomp libseccomp ++ lib.optional (withAWS && is20) ((aws-sdk-cpp.override { @@ -62,7 +66,7 @@ common = preConfigure = # Copy libboost_context so we don't get all of Boost in our closure. # https://github.com/NixOS/nixpkgs/issues/45462 - if is20 then '' + lib.optionalString is20 '' mkdir -p $out/lib cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib rm -f $out/lib/*.a @@ -70,9 +74,21 @@ common = chmod u+w $out/lib/*.so.* patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* ''} - '' else '' - configureFlagsArray+=(BDW_GC_LIBS="-lgc -lgccpp") - ''; + '' + + # For Nix-2.3, patch around an issue where the Nix configure step pulls in the + # build system's bash and other utilities when cross-compiling + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform && isExactly23) '' + mkdir tmp/ + substitute corepkgs/config.nix.in tmp/config.nix.in \ + --subst-var-by bash ${bash}/bin/bash \ + --subst-var-by coreutils ${coreutils}/bin \ + --subst-var-by bzip2 ${bzip2}/bin/bzip2 \ + --subst-var-by gzip ${gzip}/bin/gzip \ + --subst-var-by xz ${xz}/bin/xz \ + --subst-var-by tar ${gnutar}/bin/tar \ + --subst-var-by tr ${coreutils}/bin/tr + mv tmp/config.nix.in corepkgs/config.nix.in + ''; configureFlags = [ "--with-store-dir=${storeDir}" @@ -85,6 +101,7 @@ common = "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}" "--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}" "--with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix}" + "BDW_GC_LIBS=\"-lgc -lgccpp\"" ] ++ lib.optionals (is20 && stdenv.isLinux) [ "--with-sandbox-shell=${sh}/bin/busybox" ] @@ -126,8 +143,6 @@ common = }; passthru = { - inherit fromGit; - perl-bindings = if includesPerl then nix else stdenv.mkDerivation { pname = "nix-perl"; inherit version; @@ -140,7 +155,6 @@ common = # but noting for future travellers. nativeBuildInputs = [ perl pkgconfig curl nix libsodium ] - ++ lib.optionals fromGit [ autoreconfHook autoconf-archive ] ++ lib.optional is20 boost; configureFlags = @@ -174,10 +188,10 @@ in rec { }; nixStable = callPackage common (rec { - name = "nix-2.3.2"; + name = "nix-2.3.3"; src = fetchurl { url = "http://nixos.org/releases/nix/${name}/${name}.tar.xz"; - sha256 = "9fea4b52db0b296dcf05d36f7ecad9f48396af3a682bb21e31f8d04c469beef8"; + sha256 = "332fffb8dfc33eab854c136ef162a88cec15b701def71fa63714d160831ba224"; }; inherit storeDir stateDir confDir boehmgc; @@ -186,29 +200,23 @@ in rec { }); nixUnstable = lib.lowPrio (callPackage common rec { - name = "nix-2.3${suffix}"; - suffix = "pre6895_84de821"; - src = fetchFromGitHub { - owner = "NixOS"; - repo = "nix"; - rev = "84de8210040580ce7189332b43038d52c56a9689"; - sha256 = "062pdly0m2hk8ly8li5psvpbj1mi7m1a15k8wyzf79q7294l5li3"; + name = "nix-2.4${suffix}"; + suffix = "pre7250_94c93437"; + src = fetchurl { + url = "https://hydra.nixos.org/build/112193977/download/3/nix-2.4${suffix}.tar.xz"; + sha256 = "f9baf241c9449c1e3e5c9610adbcd2ce9e5fbcab16aff3ba3030d2fad7b34d7b"; }; - fromGit = true; inherit storeDir stateDir confDir boehmgc; }); nixFlakes = lib.lowPrio (callPackage common rec { name = "nix-2.4${suffix}"; - suffix = "pre20191022_9cac895"; - src = fetchFromGitHub { - owner = "NixOS"; - repo = "nix"; - rev = "9cac895406724e0304dff140379783c4d786e855"; - hash = "sha256-Y1cdnCNoJmjqyC/a+Nt2N+5L3Ttg7K7zOD7gmtg1QzA="; + suffix = "pre20200220_4a4521f"; + src = fetchurl { + url = "https://hydra.nixos.org/build/113373394/download/3/nix-2.4${suffix}.tar.xz"; + sha256 = "31fe87c40f40a590bc8f575283725d5f04ecb9aebb6b404f679d77438d75265d"; }; - fromGit = true; inherit storeDir stateDir confDir boehmgc; }); |