stdenv: remove .attrs.sh fallback for structuredAttrs

This was eventually fixed in Nix 2.16+. More discussion in #357053.
This commit is contained in:
Wolfgang Walther
2025-08-12 12:34:30 +02:00
parent cf4e81e3bc
commit 899c40e6f8
4 changed files with 4 additions and 14 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ echo "testBuildFailure: Original builder produced exit code: $r"
#
# NOTE: This MUST be done after the original builder has finished!
# Otherwise we could pollute its environment.
if [ -e "${NIX_ATTRS_SH_FILE:-}" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
if [ -e "${NIX_ATTRS_SH_FILE:-}" ]; then . "$NIX_ATTRS_SH_FILE"; fi
# Variables injected by replaceVars
#
+1 -1
View File
@@ -847,7 +847,7 @@ let
"-c"
''
out="${placeholder "out"}"
if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; fi
declare -p > $out
for var in $passAsFile; do
pathVar="''${var}Path"
+1 -11
View File
@@ -25,7 +25,7 @@ if [[ ${NIX_DEBUG:-0} -ge 6 ]]; then
set -x
fi
if [ -f .attrs.sh ] || [[ -n "${NIX_ATTRS_JSON_FILE:-}" ]]; then
if [[ -n "${NIX_ATTRS_JSON_FILE:-}" ]]; then
__structuredAttrs=1
echo "structuredAttrs is enabled"
@@ -33,16 +33,6 @@ if [ -f .attrs.sh ] || [[ -n "${NIX_ATTRS_JSON_FILE:-}" ]]; then
# ex: out=/nix/store/...
export "$outputName=${outputs[$outputName]}"
done
# $NIX_ATTRS_JSON_FILE pointed to the wrong location in sandbox
# https://github.com/NixOS/nix/issues/6736; please keep around until the
# fix reaches *every patch version* that's >= lib/minver.nix
if ! [[ -e "${NIX_ATTRS_JSON_FILE:-}" ]]; then
export NIX_ATTRS_JSON_FILE="$NIX_BUILD_TOP/.attrs.json"
fi
if ! [[ -e "${NIX_ATTRS_SH_FILE:-}" ]]; then
export NIX_ATTRS_SH_FILE="$NIX_BUILD_TOP/.attrs.sh"
fi
else
__structuredAttrs=
: "${outputs:=out}"
+1 -1
View File
@@ -1,3 +1,3 @@
if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi
if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; fi
source "$stdenv/setup"
source "$1"