From 7b8f2c9f9392a771f4492d37a29b8f331448da44 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 24 Jan 2022 19:55:22 +0100 Subject: [PATCH 1/2] Check that nix-env output doesn't depend on the Nixpkgs location (cherry picked from commit cb2f8a87d5389c7347b27937cbcde510696e36f7) --- .../nixpkgs-basic-release-checks.nix | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/pkgs/top-level/nixpkgs-basic-release-checks.nix b/pkgs/top-level/nixpkgs-basic-release-checks.nix index 350dd273fe2e..310043555929 100644 --- a/pkgs/top-level/nixpkgs-basic-release-checks.nix +++ b/pkgs/top-level/nixpkgs-basic-release-checks.nix @@ -19,15 +19,8 @@ pkgs.runCommand "nixpkgs-release-checks" { src = nixpkgs; buildInputs = [nix]; } exit 1 fi - # Make sure that derivation paths do not depend on the Nixpkgs path. - mkdir $TMPDIR/foo - ln -s $(readlink -f $src) $TMPDIR/foo/bar - p1=$(nix-instantiate $src --dry-run -A firefox --show-trace) - p2=$(nix-instantiate $TMPDIR/foo/bar --dry-run -A firefox --show-trace) - if [ "$p1" != "$p2" ]; then - echo "Nixpkgs evaluation depends on Nixpkgs path ($p1 vs $p2)!" - exit 1 - fi + src2=$TMPDIR/foo + cp -rd $src $src2 # Check that all-packages.nix evaluates on a number of platforms without any warnings. for platform in ${pkgs.lib.concatStringsSep " " supportedSystems}; do @@ -37,7 +30,25 @@ pkgs.runCommand "nixpkgs-release-checks" { src = nixpkgs; buildInputs = [nix]; } --show-trace --argstr system "$platform" \ --arg config '{ allowAliases = false; }' \ -qa --drv-path --system-filter \* --system \ - "''${opts[@]}" 2>&1 >/dev/null | tee eval-warnings.log + "''${opts[@]}" 2> eval-warnings.log > packages1 + + s1=$(sha1sum packages1 | cut -c1-40) + echo $s1 + + nix-env -f $src2 \ + --show-trace --argstr system "$platform" \ + --arg config '{ allowAliases = false; }' \ + --option experimental-features 'no-url-literals' \ + -qa --drv-path --system-filter \* --system \ + "''${opts[@]}" > packages2 + + s2=$(sha1sum packages2 | cut -c1-40) + + if [[ $s1 != $s2 ]]; then + echo "Nixpkgs evaluation depends on Nixpkgs path" + diff packages1 packages2 + exit 1 + fi if [ -s eval-warnings.log ]; then echo "Nixpkgs on $platform evaluated with warnings, aborting" From 01b7f0dda28a55c365a8d23451aa66cbe91aa86b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 24 Jan 2022 20:02:17 +0100 Subject: [PATCH 2/2] pathDerivation: Copy path Otherwise you end up with a derivation that refers to the original path (which is not in the Nix store and not accessible to builders). This caused the derivation paths for the docbookrx package (removed on master) to depend on the location of the nixpkgs source tree. (cherry picked from commit 55ae086747caa71b92f6713a58a909acef944705) --- pkgs/development/ruby-modules/bundled-common/functions.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/ruby-modules/bundled-common/functions.nix b/pkgs/development/ruby-modules/bundled-common/functions.nix index 35307a3fbd93..746eb2bb112a 100644 --- a/pkgs/development/ruby-modules/bundled-common/functions.nix +++ b/pkgs/development/ruby-modules/bundled-common/functions.nix @@ -76,7 +76,7 @@ in rec { bundledByPath = true; name = gemName; version = version; - outPath = path; + outPath = "${path}"; outputs = [ "out" ]; out = res; outputName = "out";