about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-12-03 09:30:16 +0100
committerGitHub <noreply@github.com>2023-12-03 09:30:16 +0100
commitf8a9aa9ca646691f9e192a62624b1548367b5dd9 (patch)
tree3ee88f3b3ad95ac062fe03abcc91b8b9f01f44d0 /lib
parent0e2043f5b0a9d5c0c3a388efaf8f1e2be14013c5 (diff)
lib.systems.elaborate: fix passing `rust` (more) (#271790)
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: e3e57b8f1885 ("lib.systems: elaborate Rust metadata")
Fixes: https://github.com/NixOS/nixpkgs/issues/271000
(cherry picked from commit 4d23987f4af94610ab0b76adc9d982a038eb345c)

Co-authored-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'lib')
-rw-r--r--lib/systems/default.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index 0d21175914a3d..9eec21cbf21b9 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -324,7 +324,8 @@ rec {
               "riscv64" = "riscv64gc";
             }.${cpu.name} or cpu.name;
             vendor_ = final.rust.platform.vendor;
-          in rust.config
+          # TODO: deprecate args.rustc in favour of args.rust after 23.05 is EOL.
+          in args.rust.rustcTarget or args.rustc.config
             or "${cpu_}-${vendor_}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}";
 
           # The name of the rust target if it is standard, or the json file