[2.3] build: backport NIX_ATTRS_*_FILE#12026
Merged
edolstra merged 1 commit intoNixOS:2.3-maintenancefrom Dec 9, 2024
Merged
Conversation
This was originally added in NixOS#4770 to support structured attrs in `nix-shell` & `nix develop`: the issue was that it was somewhat awkward to just write those files into a project directory, especially since it'd break in case of multiple `nix-shell` invocations from the same directory. Now the files are written to another, temporary location when using `nix-shell`/`nix develop` and the correct path is referenced by NIX_ATTRS_*_FILE. In `nixpkgs`, it's now common to use these environment variables, however we still fall back to checking to `.attrs.sh` & `.attrs.json` since the minimum Nix version we support is 2.3.17[1] which doesn't have this change. This however makes implementing structured attrs support more complicated than needed[2] and in fact we have a few places where the check for `.attrs.sh`/`.attrs.json` isn't made, so these only break with Nix 2.3[3]. The idea is now to * get this into 2.3.18 * bump minver once again to 2.3.18 in nixpkgs * remove all occurrences of `.attrs.sh`/`.attrs.json` from nixpkgs. [1] https://github.com/NixOS/nixpkgs/blob/f4bd97b8face6dc14b0ce048c20cff7e558c7be2/lib/minver.nix [2] https://github.com/NixOS/nixpkgs/pull/357053/files#diff-791a01ef89c157eb74d9c87ab8cbc3b81e2cf082cab70b8fec3472cd75ce860dR3-R5 [3] NixOS/nixpkgs#357053 (comment)
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This was originally added in #4770 to support structured attrs in
nix-shell&nix develop: the issue was that it was somewhat awkward to just write those files into a project directory, especially since it'd break in case of multiplenix-shellinvocations from the same directory. Now the files are written to another, temporary location when usingnix-shell/nix developand the correct path is referenced by NIX_ATTRS_*_FILE.In
nixpkgs, it's now common to use these environment variables, however we still fall back to checking to.attrs.sh&.attrs.jsonsince the minimum Nix version we support is 2.3.17[1] which doesn't have this change.This however makes implementing structured attrs support more complicated than needed[2] and in fact we have a few places where the check for
.attrs.sh/.attrs.jsonisn't made, so these only break with Nix 2.3[3].The idea is now to
.attrs.sh/.attrs.jsonfrom nixpkgs.[1] https://github.com/NixOS/nixpkgs/blob/f4bd97b8face6dc14b0ce048c20cff7e558c7be2/lib/minver.nix
[2] https://github.com/NixOS/nixpkgs/pull/357053/files#diff-791a01ef89c157eb74d9c87ab8cbc3b81e2cf082cab70b8fec3472cd75ce860dR3-R5
[3] NixOS/nixpkgs#357053 (comment)
Context
cc @wolfgangwalther @edolstra @Ericson2314
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.