Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a128dd3af8d5
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b4e14e9254c1
Choose a head ref
  • 4 commits
  • 2 files changed
  • 2 contributors

Commits on Apr 6, 2020

  1. nix: Patch config.nix.in to reference host platform binaries

    (cherry picked from commit f1415f6)
    eamsden authored and edolstra committed Apr 6, 2020
    Copy the full SHA
    93c13ab View commit details
  2. nix: Drive-by cleanup: replace ifthenelse with lib.optionalString

    (cherry picked from commit 3b72c55)
    eamsden authored and edolstra committed Apr 6, 2020
    Copy the full SHA
    0dda3d5 View commit details
  3. Remove Nix 1.x

    (cherry picked from commit 5d583db)
    edolstra committed Apr 6, 2020
    Copy the full SHA
    13cbfa8 View commit details
  4. nix: 2.4pre7250_94c93437 -> 2.4pre7346_5e7ccdc9, 2.4pre20200220_4a452…

    …1f -> 2.4pre20200403_3473b19
    
    (cherry picked from commit b23f697)
    edolstra committed Apr 6, 2020
    Copy the full SHA
    b4e14e9 View commit details
Showing with 59 additions and 42 deletions.
  1. +59 −41 pkgs/tools/package-management/nix/default.nix
  2. +0 −1 pkgs/top-level/all-packages.nix
100 changes: 59 additions & 41 deletions pkgs/tools/package-management/nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, fetchurl, callPackage
{ lib, fetchurl, fetchFromGitHub, callPackage
, storeDir ? "/nix/store"
, stateDir ? "/nix/var"
, confDir ? "/etc"
@@ -10,7 +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, libarchive, rustc, cargo
, busybox-sandbox-shell
, storeDir
@@ -19,7 +21,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
, name, suffix ? "", src, crates ? null

}:
let
@@ -28,24 +30,25 @@ common =
inherit name src;
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 = suffix;

outputs = [ "out" "dev" "man" "doc" ];

nativeBuildInputs =
[ pkgconfig ]
++ lib.optionals (!is20) [ curl perl ]
++ lib.optionals is24 [ jq ];
++ lib.optionals is24 [ autoreconfHook autoconf-archive bison flex libxml2 libxslt docbook5 docbook_xsl_ns jq ];

buildInputs = [ curl openssl sqlite xz bzip2 nlohmann_json ]
buildInputs =
[ curl openssl sqlite xz bzip2 nlohmann_json
brotli boost editline
]
++ 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)
++ lib.optional withAWS
((aws-sdk-cpp.override {
apis = ["s3" "transfer"];
customMemoryManagement = false;
@@ -64,17 +67,34 @@ 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 ''
''
mkdir -p $out/lib
cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib
rm -f $out/lib/*.a
${lib.optionalString stdenv.isLinux ''
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")
'';
'' +
# Unpack the Rust crates.
lib.optionalString is24 ''
tar xvf ${crates} -C nix-rust/
mv nix-rust/nix-vendored-crates* nix-rust/vendor
'' +
# 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}"
@@ -83,11 +103,7 @@ common =
"--disable-init-state"
"--enable-gc"
]
++ lib.optionals (!is20) [
"--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
"--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}"
"--with-www-curl=${perlPackages.WWWCurl}/${perl.libPrefix}"
] ++ lib.optionals (is20 && stdenv.isLinux) [
++ lib.optionals stdenv.isLinux [
"--with-sandbox-shell=${sh}/bin/busybox"
]
++ lib.optional (
@@ -128,7 +144,7 @@ common =
};

passthru = {
perl-bindings = if includesPerl then nix else stdenv.mkDerivation {
perl-bindings = stdenv.mkDerivation {
pname = "nix-perl";
inherit version;

@@ -139,8 +155,7 @@ common =
# This is not cross-compile safe, don't have time to fix right now
# but noting for future travellers.
nativeBuildInputs =
[ perl pkgconfig curl nix libsodium ]
++ lib.optional is20 boost;
[ perl pkgconfig curl nix libsodium boost autoreconfHook autoconf-archive ];

configureFlags =
[ "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}"
@@ -159,19 +174,6 @@ in rec {

nix = nixStable;

nix1 = callPackage common rec {
name = "nix-1.11.16";
src = fetchurl {
url = "http://nixos.org/releases/nix/${name}/${name}.tar.xz";
sha256 = "0ca5782fc37d62238d13a620a7b4bff6a200bab1bd63003709249a776162357c";
};

# Nix1 has the perl bindings by default, so no need to build the manually.
includesPerl = true;

inherit storeDir stateDir confDir boehmgc;
};

nixStable = callPackage common (rec {
name = "nix-2.3.2";
src = fetchurl {
@@ -186,21 +188,37 @@ in rec {

nixUnstable = lib.lowPrio (callPackage common rec {
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";
suffix = "pre7346_5e7ccdc9";

src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "5e7ccdc9e3ddd61dc85e20c898001345bfb497a5";
sha256 = "10jg0rq92xbigbbri7harn4b75blqaf6rjgq4hhvlnggf2w9iprg";
};

crates = fetchurl {
url = https://hydra.nixos.org/build/115942497/download/1/nix-vendored-crates-2.4pre20200403_3473b19.tar.xz;
sha256 = "a83785553bb4bc5b28220562153e201ec555a00171466ac08b716f0c97aee45a";
};

inherit storeDir stateDir confDir boehmgc;
});

nixFlakes = lib.lowPrio (callPackage common rec {
name = "nix-2.4${suffix}";
suffix = "pre20200220_4a4521f";
src = fetchurl {
url = "https://hydra.nixos.org/build/113373394/download/3/nix-2.4${suffix}.tar.xz";
sha256 = "31fe87c40f40a590bc8f575283725d5f04ecb9aebb6b404f679d77438d75265d";
suffix = "pre20200403_3473b19";

src = fetchFromGitHub {
owner = "NixOS";
repo = "nix";
rev = "3473b1950a90d596a3baa080fdfdb080f55a5cc0";
sha256 = "1bb7a8a5lzmb3pzq80zxd3s9y3qv757q7032s5wvp75la9wgvmvr";
};

crates = fetchurl {
url = https://hydra.nixos.org/build/115942497/download/1/nix-vendored-crates-2.4pre20200403_3473b19.tar.xz;
sha256 = "a83785553bb4bc5b28220562153e201ec555a00171466ac08b716f0c97aee45a";
};

inherit storeDir stateDir confDir boehmgc;
1 change: 0 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
@@ -24997,7 +24997,6 @@ in
boehmgc = boehmgc.override { enableLargeConfig = true; };
})
nix
nix1
nixStable
nixUnstable
nixFlakes;