diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2023-05-31 19:41:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 19:41:58 +0200 |
commit | dae6b98a9058ce8a28bdd87d6a1fea0233f0ec27 (patch) | |
tree | 804944728e6fd7cc366203adf3c46114025bd8d4 /pkgs/stdenv | |
parent | 421a6f37b1bf21fa68d7325d6841f8d4f296e74f (diff) | |
parent | 1a29857b8a93f5259f0c2e919becc0bf9db24f85 (diff) |
Merge pull request #234883 from sternenseemann/nix-structured-attrs
stdenv/setup.sh: deal with Nix < 2.4 structured attrs
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/generic/setup.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 1861b044a394b..1f596ada5a0b0 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -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 |