lib.systems.elaborate: fix passing rust (more)#271707
Conversation
yu-re-ka
left a comment
There was a problem hiding this comment.
This fixes the build of an armv7l cross NixOS for me.
Thanks!
|
We should check out of tree Rust builders to see what they do regarding that. |
Regarding what exactly? |
misuzu
left a comment
There was a problem hiding this comment.
LGTM! Fixes both armv7l & riscv64 issue for me
Regarding whether they pass |
If they pass Which out-of-tree things do you think we should be checking? |
crane, cargo2nix, naersk (?) are the ones on the top of my mind. |
|
cargo2nix and naersk haven't had any changes since |
|
In this case, this breaking change is exceptionally allowed because of no "popular" out-of-tree consumers maybe depending upon it. |
An important idea around the rust stuff in lib.systems is that it's
elaborated — this means that it should idempotently add to the values
passed in, if any. But we missed that the names used for the
parameter and the elaborated value for "rustcTarget"/"config" didn't
line up. The intention was to use "rustcTarget" everywhere in the new
interface, as a more descriptive name than "config".
This fixes setting the system in NixOS configuration, which results in
an already elaborated system being elaborated again. Before, this
wouldn't produce the correct result:
% nix-instantiate --eval -A stdenv.hostPlatform.rust.rustcTarget --system armv7l-linux
"armv7-unknown-linux-gnueabihf"
% NIX_PATH= nix-instantiate --eval -E '(import nixos/lib/eval-config.nix { system = "armv7l-linux"; modules = []; }).pkgs.stdenv.hostPlatform.rust.rustcTarget'
"arm-unknown-linux-gnueabihf"
Fixes: e3e57b8 ("lib.systems: elaborate Rust metadata")
Fixes: NixOS#271000
|
Successfully created backport PR for |
|
This change broke |
|
Ah yes, whoops, we had an in-tree use of rust.config. |
rust.config was never intended to exist, and has been removed. Link: NixOS#271707 (comment) Fixes: 9731208 ("lib.systems.elaborate: fix passing `rust` (more) (NixOS#271707)")
rust.config was never intended to exist, and has been removed. Link: #271707 (comment) Fixes: 9731208 ("lib.systems.elaborate: fix passing `rust` (more) (#271707)") (cherry picked from commit a449e06)
rust.config was never intended to exist, and has been removed. Link: #271707 (comment) Fixes: 9731208 ("lib.systems.elaborate: fix passing `rust` (more) (#271707)") (cherry picked from commit a449e06)
rust.config was never intended to exist, and has been removed. Link: NixOS#271707 (comment) Fixes: 9731208 ("lib.systems.elaborate: fix passing `rust` (more) (NixOS#271707)")
`rustc.config` is called `rust.rustcTarget` now, and
`{rustc -> rust}.platform`.
This is the new way (tm), and is preferred since
NixOS#271707 -
though the documentation still is outdated, and some expressions in
nixpkgs were using the old interface.
This updates both.
|
I updated the docs and remaining references to |
`rustc.config` is called `rust.rustcTarget` now, and
`{rustc -> rust}.platform`.
This is the new way (tm), and is preferred since
NixOS/nixpkgs#271707 -
though the documentation still is outdated, and some expressions in
nixpkgs were using the old interface.
This updates both.
Description of changes
An important idea around the rust stuff in lib.systems is that it's elaborated — this means that it should idempotently add to the values passed in, if any. But we missed that the names used for the parameter and the elaborated value for "rustcTarget"/"config" didn't line up. The intention was to use "rustcTarget" everywhere in the new interface, as a more descriptive name than "config".
This fixes setting the system in NixOS configuration, which results in an already elaborated system being elaborated again. Before, this wouldn't produce the correct result:
Fixes: #271000
Very technically, this is a backwards-incompatible change, as for about a couple of weeks it was accidentally possible to pass
rust.config(as opposed to the old interface,rustc.config, which has been supported for years and continues to be until it's eventually removed after a deprecation period). This was unintentional, undocumented (the documentation still points people towards the old interface for now), only possible for a couple of weeks, and there was no reason to do it. If we really had to, we could do a proper deprecation period for the accidentallyrust.configas well, but I don't think there's any reason to, and it would extend this whole project by six more months. But if the RMs really think we have to, we can.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Priorities
Add a 👍 reaction to pull requests you find important.