Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stdenv/setup.sh: deal with Nix < 2.4 structured attrs #234883

Merged
merged 1 commit into from
May 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pkgs/stdenv/generic/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,23 @@ if [ -n "$__structuredAttrs" ]; then
export "$outputName=${outputs[$outputName]}"
done

# Before Nix 2.4, $NIX_ATTRS_*_FILE was named differently:
# https://github.com/NixOS/nix/commit/27ce722
if [[ -n "${ATTRS_JSON_FILE:-}" ]]; then
export NIX_ATTRS_JSON_FILE="$ATTRS_JSON_FILE"
fi

if [[ -n "${ATTRS_SH_FILE:-}" ]]; then
export NIX_ATTRS_SH_FILE="$ATTRS_SH_FILE"
fi

# $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
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
if ! [[ -e "${NIX_ATTRS_SH_FILE:-}" ]]; then
export NIX_ATTRS_SH_FILE="$NIX_BUILD_TOP/.attrs.sh"
fi
else
Expand Down