Skip to content

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

Merged
roberth merged 1 commit intoNixOS:stagingfrom
sternenseemann:nix-structured-attrs
May 31, 2023
Merged

stdenv/setup.sh: deal with Nix < 2.4 structured attrs#234883
roberth merged 1 commit intoNixOS:stagingfrom
sternenseemann:nix-structured-attrs

Conversation

@sternenseemann
Copy link
Member

Nix does not (as far it is documented) guarantee that NIX_ATTRS_*_FILE is set, the only documented guarantee seems to be:

[…] made available to the builder via the file .attrs.json in the
builder’s temporary directory.

This guarantee is of course affected by NixOS/nix#6736, so it seems to be prudent to fall back to the Nix 2.3 style ATTRS_*_FILE env vars before defaulting to the expected location in case neither is available.

See also:

Tested tests.stdenv.test-structured-env-attrset with Nix 2.3 to verify.

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Nix does not (as far it is documented) guarantee that NIX_ATTRS_*_FILE
is set, the only [documented] guarantee seems to be:

> […] made available to the builder via the file .attrs.json in the
> builder’s temporary directory.

This guarantee is of course affected by NixOS/nix#6736,
so it seems to be prudent to fall back to the Nix 2.3 style ATTRS_*_FILE
env vars before defaulting to the expected location in case neither is
available.

See also:

- NixOS#214937 (comment)
- NixOS@afef6588e250

[documented]: https://nixos.org/manual/nix/stable/language/advanced-attributes.html#adv-attr-structuredAttrs
@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels May 30, 2023
tvlbot pushed a commit to tvlfyi/tvix that referenced this pull request May 30, 2023
* 3p/buzz: delete package

  This is unused, old, and uses an insecure version of OpenSSL which
  broke eval.

* 3p/overlays: remove nvd patch

  Newer versions of nvd are compatible with Nix 2.3 by default.

* users/grfn/system/home: remove explicit rust-analyser package

  This conflicts with `rustup`, causing eval failures, as the wrapper
  seems to now be included in `rustup` by default.

* users/grfn/system: temporarily disable ISO builds

  They were broken upstream in nixpkgs by a change to stdenv/setup.sh,
  being fixed in NixOS/nixpkgs#234883

Change-Id: I0eea99ec98f4e73e615c012ffae1d0e37122e73b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8585
Tested-by: BuildkiteCI
Reviewed-by: grfn <[email protected]>
Reviewed-by: sterni <[email protected]>
Autosubmit: tazjin <[email protected]>
tvlbot pushed a commit to tvlfyi/kit that referenced this pull request May 30, 2023
* 3p/buzz: delete package

  This is unused, old, and uses an insecure version of OpenSSL which
  broke eval.

* 3p/overlays: remove nvd patch

  Newer versions of nvd are compatible with Nix 2.3 by default.

* users/grfn/system/home: remove explicit rust-analyser package

  This conflicts with `rustup`, causing eval failures, as the wrapper
  seems to now be included in `rustup` by default.

* users/grfn/system: temporarily disable ISO builds

  They were broken upstream in nixpkgs by a change to stdenv/setup.sh,
  being fixed in NixOS/nixpkgs#234883

Change-Id: I0eea99ec98f4e73e615c012ffae1d0e37122e73b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8585
Tested-by: BuildkiteCI
Reviewed-by: grfn <[email protected]>
Reviewed-by: sterni <[email protected]>
Autosubmit: tazjin <[email protected]>
@github-actions
Copy link
Contributor

Successfully created backport PR for staging-23.05:

@sternenseemann sternenseemann deleted the nix-structured-attrs branch October 1, 2023 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: stdenv Standard environment 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants