From 66cddd6a6c5da0a26fffb99bd9006cf6191b3f99 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:12:29 -0400 Subject: gst_all_1.gstreamer: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/core/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/core/default.nix b/pkgs/development/libraries/gstreamer/core/default.nix index ed7396f291c..96899b63e5b 100644 --- a/pkgs/development/libraries/gstreamer/core/default.nix +++ b/pkgs/development/libraries/gstreamer/core/default.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "gstreamer"; - version = "1.22.5"; + version = "1.22.6"; outputs = [ "bin" @@ -36,7 +36,7 @@ stdenv.mkDerivation (finalAttrs: { inherit (finalAttrs) pname version; in fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-RAjXkw84GAnoWReswZcS8XMmG6hb3yDFVnsqIbEZO2E="; + hash = "sha256-9QDmz93/VZCPk3cR/CaghA3iih6exJYhwLbxrb2PgY4="; }; depsBuildBuild = [ -- cgit 1.4.1 From fa7fdeabb25640f3cd5a1fe2369602033c511bd7 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:12:42 -0400 Subject: gst_all_1.gst-plugins-base: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/base/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/base/default.nix b/pkgs/development/libraries/gstreamer/base/default.nix index 449873bc7c5..d9b624a5994 100644 --- a/pkgs/development/libraries/gstreamer/base/default.nix +++ b/pkgs/development/libraries/gstreamer/base/default.nix @@ -45,7 +45,7 @@ stdenv.mkDerivation (finalAttrs: { pname = "gst-plugins-base"; - version = "1.22.5"; + version = "1.22.6"; outputs = [ "out" "dev" ]; @@ -53,7 +53,7 @@ stdenv.mkDerivation (finalAttrs: { inherit (finalAttrs) pname version; in fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-7dQzi0XCapryjA01qrlkoCTDiEum9SDYQo3wQhLIyTo="; + hash = "sha256-UPK00XwC7v5DC776jFzRNLG+eKU8D2DpURNtls9J/Us="; }; strictDeps = true; -- cgit 1.4.1 From cd34ad5cd78e917baaa54741353ad788ec868414 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:22:24 -0400 Subject: gst_all_1.gst-plugins-good: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/good/default.nix | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix index f967e2e0ce1..9599da0fdf5 100644 --- a/pkgs/development/libraries/gstreamer/good/default.nix +++ b/pkgs/development/libraries/gstreamer/good/default.nix @@ -52,26 +52,15 @@ assert raspiCameraSupport -> (stdenv.isLinux && stdenv.isAarch32); stdenv.mkDerivation rec { pname = "gst-plugins-good"; - version = "1.22.5"; + version = "1.22.6"; outputs = [ "out" "dev" ]; src = fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-tnsxMTpUxpKbgpadQdPP3y9Y21c/tfSR5rul2ErqB3g="; + hash = "sha256-s7B/4/HOf+k6qb5yF4ZgRFSPNcSneSKA7sfhCKMvmBc="; }; - # TODO: Patch is conditional to spare rebuilds during the current staging-next cycle and should be removed during the next bump - patches = lib.optionals qt5Support [ - # Needed until https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5083 is merged and released - (fetchpatch { - name = "gst-plugins-good-fix-qt5-without-viv-fb.patch"; - url = "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/03d8ef0b7c6e70eb936de0514831c1aafc763dcf.diff"; - hash = "sha256-17XU/W/TMPg5669O1EBXByAN/VwFu/0idTg5ze3M/D4="; - stripLen = 2; - }) - ]; - strictDeps = true; depsBuildBuild = [ pkg-config ]; @@ -90,6 +79,7 @@ stdenv.mkDerivation rec { hotdoc ] ++ lib.optionals qt5Support (with qt5; [ qtbase + qttools ]) ++ lib.optionals qt6Support (with qt6; [ qtbase qttools -- cgit 1.4.1 From a437fd6db36cd0ce1eb9098df665d8c3e0a28af2 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:13:04 -0400 Subject: gst_all_1.gst-plugins-bad: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/bad/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix index 276f2d192ef..72c8b76e59f 100644 --- a/pkgs/development/libraries/gstreamer/bad/default.nix +++ b/pkgs/development/libraries/gstreamer/bad/default.nix @@ -109,13 +109,13 @@ stdenv.mkDerivation rec { pname = "gst-plugins-bad"; - version = "1.22.5"; + version = "1.22.6"; outputs = [ "out" "dev" ]; src = fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-5k51za/X/y/H/DToVbBrHj7SJ8wG+jeNF7vNdngMM4w="; + hash = "sha256-tAKc0pCKCJxV8dkCpWXQB0lclbFELYOEhdxH+xLfcTc="; }; patches = [ -- cgit 1.4.1 From be4c86dc71c9c49d62cbe978c89ec1d10bf8cea0 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:13:13 -0400 Subject: gst_all_1.gst-plugins-ugly: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/ugly/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/ugly/default.nix b/pkgs/development/libraries/gstreamer/ugly/default.nix index 2392d7f341d..cf5f93707cc 100644 --- a/pkgs/development/libraries/gstreamer/ugly/default.nix +++ b/pkgs/development/libraries/gstreamer/ugly/default.nix @@ -26,13 +26,13 @@ stdenv.mkDerivation rec { pname = "gst-plugins-ugly"; - version = "1.22.5"; + version = "1.22.6"; outputs = [ "out" "dev" ]; src = fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-JoBHOyGBWPGEZ8rD4cUCkbf/TgcQ3TUKWeqsvCnAmlQ="; + hash = "sha256-PjFFTJjLL39tLTVezrkzqJL6Dx3Am8NsmryTDY4pykg="; }; nativeBuildInputs = [ -- cgit 1.4.1 From a71f781c64376e654fe4ab1519adef9998cbc64e Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:13:36 -0400 Subject: gst_all_1.gst-libav: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/libav/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/libav/default.nix b/pkgs/development/libraries/gstreamer/libav/default.nix index 2309e8717e2..7dbd9b61cbc 100644 --- a/pkgs/development/libraries/gstreamer/libav/default.nix +++ b/pkgs/development/libraries/gstreamer/libav/default.nix @@ -18,11 +18,11 @@ stdenv.mkDerivation rec { pname = "gst-libav"; - version = "1.22.5"; + version = "1.22.6"; src = fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-hYPwwfT8sB7tEfoePCESZUOovXOe1Pwdsx91alqwHZo="; + hash = "sha256-d4nmQIOIol8jy/lIz8XGIw1zW7zYt/N/SgHJ40ih46c="; }; outputs = [ "out" "dev" ]; -- cgit 1.4.1 From e4f7b6eb26f75b40dbb9cb3d730fe4c87f1f403c Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:13:53 -0400 Subject: gst_all_1.gst-vaapi: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/vaapi/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/vaapi/default.nix b/pkgs/development/libraries/gstreamer/vaapi/default.nix index c5d400048df..d2227763f4e 100644 --- a/pkgs/development/libraries/gstreamer/vaapi/default.nix +++ b/pkgs/development/libraries/gstreamer/vaapi/default.nix @@ -24,11 +24,11 @@ stdenv.mkDerivation rec { pname = "gstreamer-vaapi"; - version = "1.22.5"; + version = "1.22.6"; src = fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-qaVQJnyVhN8OjHBDTTBHbo/QAYtzPBwe4z3q9CK9sks="; + hash = "sha256-2bovwmvvmMeOmCxZn1hdRru2X+Ei2onC16tB9GilLHs="; }; outputs = [ -- cgit 1.4.1 From 0eea081aa98e19e23076b6fdac5e09d8a9ca1406 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:14:20 -0400 Subject: gst_all_1.gst-devtools: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/devtools/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/devtools/default.nix b/pkgs/development/libraries/gstreamer/devtools/default.nix index 5b1396f35d5..917a5041eee 100644 --- a/pkgs/development/libraries/gstreamer/devtools/default.nix +++ b/pkgs/development/libraries/gstreamer/devtools/default.nix @@ -17,11 +17,11 @@ stdenv.mkDerivation rec { pname = "gst-devtools"; - version = "1.22.5"; + version = "1.22.6"; src = fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-Kt0VGapu6wHVRMuUKTaI7jvCB59rymB1v1wj0AoJIb4="; + hash = "sha256-iShWDvrxYTfDAoXnGHCOXQurB3frTvgSfgJ04SDT2Gs="; }; outputs = [ -- cgit 1.4.1 From da1be61c8e5f5565b04b1aa8ec97f14758712495 Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:14:29 -0400 Subject: gst_all_1.gst-rtsp-server: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/rtsp-server/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/rtsp-server/default.nix b/pkgs/development/libraries/gstreamer/rtsp-server/default.nix index 885726ee2ac..aa211eb51a5 100644 --- a/pkgs/development/libraries/gstreamer/rtsp-server/default.nix +++ b/pkgs/development/libraries/gstreamer/rtsp-server/default.nix @@ -15,11 +15,11 @@ stdenv.mkDerivation rec { pname = "gst-rtsp-server"; - version = "1.22.5"; + version = "1.22.6"; src = fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-80PrVJZOvU2MBxvl7srVhvKP6wFW4DbgaxSNDn/rscA="; + hash = "sha256-CuM6i1BEO2LxFYGpGB6Qa0HNOHey15nb6nKRLD7aS7M="; }; outputs = [ -- cgit 1.4.1 From dbf77d3039f377ab5f56e5445f93f81b009df21f Mon Sep 17 00:00:00 2001 From: Lily Foster Date: Wed, 27 Sep 2023 17:14:44 -0400 Subject: gst_all_1.gst-editing-services: 1.22.5 -> 1.22.6 --- pkgs/development/libraries/gstreamer/ges/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/ges/default.nix b/pkgs/development/libraries/gstreamer/ges/default.nix index a8bbb632055..93ddc619a57 100644 --- a/pkgs/development/libraries/gstreamer/ges/default.nix +++ b/pkgs/development/libraries/gstreamer/ges/default.nix @@ -18,7 +18,7 @@ stdenv.mkDerivation rec { pname = "gst-editing-services"; - version = "1.22.5"; + version = "1.22.6"; outputs = [ "out" @@ -27,7 +27,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "https://gstreamer.freedesktop.org/src/${pname}/${pname}-${version}.tar.xz"; - hash = "sha256-vM3TvWHYaCmxbODiBtthsz95SsF5JCP558xl110aMbU="; + hash = "sha256-dI1CNnLFl/h24TCAT7mEhI9bS4nv14pQbLF/dkZ5UwE="; }; nativeBuildInputs = [ -- cgit 1.4.1 From 43df859d0158e4f076dc610aec91cdeb27706875 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Fri, 25 Aug 2023 22:13:40 +0800 Subject: gst_all_1.gst-plugins-good: Add missing libGL With cairo 1.18.0 bump, cairo-gl will be dropped, and cairo will no longer propagate libGL, this leads to: Run-time dependency gstreamer-gl-prototypes-1.0 found: NO glesv2 is in gstreamer-gl-prototypes-1.0's Requires, so adding libGL. --- pkgs/development/libraries/gstreamer/good/default.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix index 9599da0fdf5..8ff8220aa75 100644 --- a/pkgs/development/libraries/gstreamer/good/default.nix +++ b/pkgs/development/libraries/gstreamer/good/default.nix @@ -10,6 +10,7 @@ , orc , bzip2 , gettext +, libGL , libv4l , libdv , libavc1394 @@ -129,6 +130,7 @@ stdenv.mkDerivation rec { ]) ++ lib.optionals stdenv.isDarwin [ Cocoa ] ++ lib.optionals stdenv.isLinux [ + libGL libv4l libpulseaudio libavc1394 -- cgit 1.4.1 From e3e57b8f1885bf1dc4787728479711f46a4171cc Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 9 May 2023 13:38:32 +0000 Subject: lib.systems: elaborate Rust metadata We need this stuff to be available in lib so make-derivation.nix can access it to construct the Meson cross file. This has a couple of other advantages: - It makes Rust less special. Now figuring out what Rust calls a platform is the same as figuring out what Linux or QEMU call it. - We can unify the schema used to define Rust targets, and the schema used to access those values later. Just like you can set "config" or "system" in a platform definition, and then access those same keys on the elaborated platform, you can now set "rustcTarget" in your crossSystem, and then access "stdenv.hostPlatform.rustcTarget" in your code. "rustcTarget", "rustcTargetSpec", "cargoShortTarget", and "cargoEnvVarTarget" have the "rustc" and "cargo" prefixes because these are not exposed to code by the compiler, and are not standardized. The arch/os/etc. variables are all named to match the forms in the Rust target spec JSON. The new rust.target-family only takes a list, since we don't need to worry about backwards compatibility when that name is used. The old APIs are all still functional with no warning for now, so that it's possible for external code to use a single API on both 23.05 and 23.11. We can introduce the warnings once 23.05 is EOL, and make them hard errors when 23.11 is EOL. --- lib/systems/default.nix | 100 +++++++++++++++- pkgs/applications/blockchains/zcash/default.nix | 4 +- pkgs/applications/misc/effitask/default.nix | 3 +- .../window-managers/cosmic/applets/default.nix | 6 +- .../window-managers/cosmic/panel/default.nix | 6 +- .../window-managers/cosmic/settings/default.nix | 2 +- .../rust/build-rust-crate/build-crate.nix | 3 +- .../rust/build-rust-crate/configure-crate.nix | 10 +- .../rust/build-rust-crate/default.nix | 11 +- .../rust/build-rust-package/default.nix | 5 +- .../rust/build-rust-package/sysroot/default.nix | 4 +- pkgs/build-support/rust/hooks/default.nix | 6 +- pkgs/build-support/rust/lib/default.nix | 127 +++++---------------- pkgs/desktops/gnome/core/gnome-tour/default.nix | 3 +- pkgs/development/compilers/mrustc/bootstrap.nix | 6 +- pkgs/development/compilers/rust/bootstrap.nix | 4 +- pkgs/development/compilers/rust/cargo.nix | 4 +- pkgs/development/compilers/rust/rustc.nix | 38 +++--- .../interpreters/python/hooks/default.nix | 8 +- .../development/libraries/gstreamer/rs/default.nix | 3 +- pkgs/development/libraries/libdovi/default.nix | 10 +- .../libraries/libimagequant/default.nix | 7 +- pkgs/development/libraries/librsvg/default.nix | 3 +- pkgs/development/libraries/relibc/default.nix | 2 +- .../libraries/rustc-demangle/default.nix | 4 +- pkgs/development/tools/lalrpop/default.nix | 3 +- .../tools/rust/cargo-benchcmp/default.nix | 3 +- .../development/tools/rust/cargo-watch/default.nix | 3 +- pkgs/development/web/deno/librusty_v8.nix | 5 +- pkgs/development/web/deno/update/librusty_v8.ts | 5 +- pkgs/development/web/edge-runtime/librusty_v8.nix | 5 +- pkgs/servers/http/router/librusty_v8.nix | 5 +- .../matrix-synapse/matrix-hookshot/default.nix | 3 +- pkgs/servers/windmill/default.nix | 4 +- pkgs/tools/misc/halp/default.nix | 3 +- pkgs/tools/system/zram-generator/default.nix | 3 +- pkgs/tools/video/rav1e/default.nix | 9 +- 37 files changed, 211 insertions(+), 219 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 2790ea08d97..ada8c66e361 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -43,6 +43,10 @@ rec { elaborate = args': let args = if lib.isString args' then { system = args'; } else args'; + + # TODO: deprecate args.rustc in favour of args.rust after 23.05 is EOL. + rust = assert !(args ? rust && args ? rustc); args.rust or args.rustc or {}; + final = { # Prefer to parse `config` as it is strictly more informative. parsed = parse.mkSystemFromString (if args ? config then args.config else args.system); @@ -159,9 +163,101 @@ rec { ({ linux-kernel = args.linux-kernel or {}; gcc = args.gcc or {}; - rustc = args.rustc or {}; } // platforms.select final) - linux-kernel gcc rustc; + linux-kernel gcc; + + # TODO: remove after 23.05 is EOL, with an error pointing to the rust.* attrs. + rustc = args.rustc or {}; + + rust = rust // { + # Once args.rustc.platform.target-family is deprecated and + # removed, there will no longer be any need to modify any + # values from args.rust.platform, so we can drop all the + # "args ? rust" etc. checks, and merge args.rust.platform in + # /after/. + platform = rust.platform or {} // { + # https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch + arch = + /**/ if rust ? platform then rust.platform.arch + else if final.isAarch32 then "arm" + else if final.isMips64 then "mips64" # never add "el" suffix + else if final.isPower64 then "powerpc64" # never add "le" suffix + else final.parsed.cpu.name; + + # https://doc.rust-lang.org/reference/conditional-compilation.html#target_os + os = + /**/ if rust ? platform then rust.platform.os or "none" + else if final.isDarwin then "macos" + else final.parsed.kernel.name; + + # https://doc.rust-lang.org/reference/conditional-compilation.html#target_family + target-family = + /**/ if args ? rust.platform.target-family then args.rust.platform.target-family + else if args ? rustc.platform.target-family + then + ( + # Since https://github.com/rust-lang/rust/pull/84072 + # `target-family` is a list instead of single value. + let + f = args.rustc.platform.target-family; + in + if builtins.isList f then f else [ f ] + ) + else lib.optional final.isUnix "unix" + ++ lib.optional final.isWindows "windows"; + + # https://doc.rust-lang.org/reference/conditional-compilation.html#target_vendor + vendor = let + inherit (final.parsed) vendor; + in rust.platform.vendor or { + "w64" = "pc"; + }.${vendor.name} or vendor.name; + }; + + # The name of the rust target, even if it is custom. Adjustments are + # because rust has slightly different naming conventions than we do. + rustcTarget = let + inherit (final.parsed) cpu kernel abi; + cpu_ = rust.platform.arch or { + "armv7a" = "armv7"; + "armv7l" = "armv7"; + "armv6l" = "arm"; + "armv5tel" = "armv5te"; + "riscv64" = "riscv64gc"; + }.${cpu.name} or cpu.name; + vendor_ = final.rust.platform.vendor; + in rust.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 + # containing the custom target spec. + rustcTargetSpec = + /**/ if rust ? platform + then builtins.toFile (final.rust.rustcTarget + ".json") (builtins.toJSON rust.platform) + else final.rust.rustcTarget; + + # The name of the rust target if it is standard, or the + # basename of the file containing the custom target spec, + # without the .json extension. + # + # This is the name used by Cargo for target subdirectories. + cargoShortTarget = + lib.removeSuffix ".json" (baseNameOf "${final.rust.rustcTargetSpec}"); + + # When used as part of an environment variable name, triples are + # uppercased and have all hyphens replaced by underscores: + # + # https://github.com/rust-lang/cargo/pull/9169 + # https://github.com/rust-lang/cargo/issues/8285#issuecomment-634202431 + cargoEnvVarTarget = + lib.strings.replaceStrings ["-"] ["_"] + (lib.strings.toUpper final.rust.cargoShortTarget); + + # True if the target is no_std + # https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421 + isNoStdTarget = + builtins.any (t: lib.hasInfix t final.rust.rustcTarget) ["-none" "nvptx" "switch" "-uefi"]; + }; linuxArch = if final.isAarch32 then "arm" diff --git a/pkgs/applications/blockchains/zcash/default.nix b/pkgs/applications/blockchains/zcash/default.nix index c07f94e5bae..dbada09c1b6 100644 --- a/pkgs/applications/blockchains/zcash/default.nix +++ b/pkgs/applications/blockchains/zcash/default.nix @@ -1,5 +1,5 @@ { autoreconfHook, boost180, cargo, coreutils, curl, cxx-rs, db62, fetchFromGitHub -, git, hexdump, lib, libevent, libsodium, makeWrapper, rust, rustPlatform +, git, hexdump, lib, libevent, libsodium, makeWrapper, rustPlatform , pkg-config, Security, stdenv, testers, tl-expected, utf8cpp, util-linux, zcash, zeromq }: @@ -57,7 +57,7 @@ rustPlatform.buildRustPackage.override { inherit stdenv; } rec { configureFlags = [ "--disable-tests" "--with-boost-libdir=${lib.getLib boost180}/lib" - "RUST_TARGET=${rust.toRustTargetSpec stdenv.hostPlatform}" + "RUST_TARGET=${stdenv.hostPlatform.rust.rustcTargetSpec}" ]; enableParallelBuilding = true; diff --git a/pkgs/applications/misc/effitask/default.nix b/pkgs/applications/misc/effitask/default.nix index a380a06741e..50172b9d1cb 100644 --- a/pkgs/applications/misc/effitask/default.nix +++ b/pkgs/applications/misc/effitask/default.nix @@ -5,7 +5,6 @@ , openssl , gtk3 , stdenv -, rust }: rustPlatform.buildRustPackage rec { @@ -28,7 +27,7 @@ rustPlatform.buildRustPackage rec { # default installPhase don't install assets installPhase = '' runHook preInstall - make install PREFIX="$out" TARGET="target/${rust.toRustTarget stdenv.hostPlatform}/release/effitask" + make install PREFIX="$out" TARGET="target/${stdenv.hostPlatform.rust.rustcTarget}/release/effitask" runHook postInstall ''; diff --git a/pkgs/applications/window-managers/cosmic/applets/default.nix b/pkgs/applications/window-managers/cosmic/applets/default.nix index f64f6b31247..87da5b580e2 100644 --- a/pkgs/applications/window-managers/cosmic/applets/default.nix +++ b/pkgs/applications/window-managers/cosmic/applets/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, rust, rustPlatform +{ lib, stdenv, fetchFromGitHub, rustPlatform , cargo, just, pkg-config, util-linuxMinimal , dbus, glib, libxkbcommon, pulseaudio, wayland }: @@ -41,11 +41,11 @@ rustPlatform.buildRustPackage { justFlags = [ "--set" "prefix" (placeholder "out") - "--set" "target" "${rust.lib.toRustTargetSpecShort stdenv.hostPlatform}/release" + "--set" "target" "${stdenv.hostPlatform.rust.cargoShortTarget}/release" ]; # Force linking to libwayland-client, which is always dlopen()ed. - "CARGO_TARGET_${rust.toRustTargetForUseInEnvVars stdenv.hostPlatform}_RUSTFLAGS" = + "CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = map (a: "-C link-arg=${a}") [ "-Wl,--push-state,--no-as-needed" "-lwayland-client" diff --git a/pkgs/applications/window-managers/cosmic/panel/default.nix b/pkgs/applications/window-managers/cosmic/panel/default.nix index 7908eeb3057..e5000fe184e 100644 --- a/pkgs/applications/window-managers/cosmic/panel/default.nix +++ b/pkgs/applications/window-managers/cosmic/panel/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, cargo, just, pkg-config, rust, rustPlatform +{ lib, stdenv, fetchFromGitHub, cargo, just, pkg-config, rustPlatform , libglvnd, libxkbcommon, wayland }: @@ -33,11 +33,11 @@ rustPlatform.buildRustPackage { justFlags = [ "--set" "prefix" (placeholder "out") - "--set" "bin-src" "target/${rust.lib.toRustTargetSpecShort stdenv.hostPlatform}/release/cosmic-panel" + "--set" "bin-src" "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-panel" ]; # Force linking to libEGL, which is always dlopen()ed. - "CARGO_TARGET_${rust.toRustTargetForUseInEnvVars stdenv.hostPlatform}_RUSTFLAGS" = + "CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_RUSTFLAGS" = map (a: "-C link-arg=${a}") [ "-Wl,--push-state,--no-as-needed" "-lEGL" diff --git a/pkgs/applications/window-managers/cosmic/settings/default.nix b/pkgs/applications/window-managers/cosmic/settings/default.nix index 6767f963846..100d1ec316f 100644 --- a/pkgs/applications/window-managers/cosmic/settings/default.nix +++ b/pkgs/applications/window-managers/cosmic/settings/default.nix @@ -61,7 +61,7 @@ rustPlatform.buildRustPackage { (placeholder "out") "--set" "bin-src" - "target/${rust.lib.toRustTargetSpecShort stdenv.hostPlatform}/release/cosmic-settings" + "target/${stdenv.hostPlatform.rust.cargoShortTarget}/release/cosmic-settings" ]; meta = with lib; { diff --git a/pkgs/build-support/rust/build-rust-crate/build-crate.nix b/pkgs/build-support/rust/build-rust-crate/build-crate.nix index 944434472b0..e842b6a3f50 100644 --- a/pkgs/build-support/rust/build-rust-crate/build-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate/build-crate.nix @@ -1,6 +1,5 @@ { lib, stdenv , mkRustcDepArgs, mkRustcFeatureArgs, needUnstableCLI -, rust }: { crateName, @@ -21,7 +20,7 @@ (mkRustcDepArgs dependencies crateRenames) (mkRustcFeatureArgs crateFeatures) ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "--target" (rust.toRustTargetSpec stdenv.hostPlatform) + "--target" stdenv.hostPlatform.rust.rustcTargetSpec ] ++ lib.optionals (needUnstableCLI dependencies) [ "-Z" "unstable-options" ] ++ extraRustcOpts diff --git a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix index 60310f17874..a6f2528a82b 100644 --- a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, rust, echo_colored, noisily, mkRustcDepArgs, mkRustcFeatureArgs }: +{ lib, stdenv, echo_colored, noisily, mkRustcDepArgs, mkRustcFeatureArgs }: { build , buildDependencies @@ -124,8 +124,8 @@ in '' export CARGO_PKG_AUTHORS="${authors}" export CARGO_PKG_DESCRIPTION="${crateDescription}" - export CARGO_CFG_TARGET_ARCH=${rust.toTargetArch stdenv.hostPlatform} - export CARGO_CFG_TARGET_OS=${rust.toTargetOs stdenv.hostPlatform} + export CARGO_CFG_TARGET_ARCH=${stdenv.hostPlatform.rust.platform.arch} + export CARGO_CFG_TARGET_OS=${stdenv.hostPlatform.rust.platform.os} export CARGO_CFG_TARGET_FAMILY="unix" export CARGO_CFG_UNIX=1 export CARGO_CFG_TARGET_ENV="gnu" @@ -136,8 +136,8 @@ in '' export CARGO_MANIFEST_DIR=$(pwd) export DEBUG="${toString (!release)}" export OPT_LEVEL="${toString optLevel}" - export TARGET="${rust.toRustTargetSpec stdenv.hostPlatform}" - export HOST="${rust.toRustTargetSpec stdenv.buildPlatform}" + export TARGET="${stdenv.hostPlatform.rust.rustcTargetSpec}" + export HOST="${stdenv.buildPlatform.rust.rustcTargetSpec}" export PROFILE=${if release then "release" else "debug"} export OUT_DIR=$(pwd)/target/build/${crateName}.out export CARGO_PKG_VERSION_MAJOR=${lib.elemAt version 0} diff --git a/pkgs/build-support/rust/build-rust-crate/default.nix b/pkgs/build-support/rust/build-rust-crate/default.nix index d977fb9f7c2..d569142af66 100644 --- a/pkgs/build-support/rust/build-rust-crate/default.nix +++ b/pkgs/build-support/rust/build-rust-crate/default.nix @@ -10,7 +10,6 @@ , fetchCrate , pkgsBuildBuild , rustc -, rust , cargo , jq , libiconv @@ -71,18 +70,14 @@ let inherit (import ./log.nix { inherit lib; }) noisily echo_colored; configureCrate = import ./configure-crate.nix { - inherit lib stdenv rust echo_colored noisily mkRustcDepArgs mkRustcFeatureArgs; + inherit lib stdenv echo_colored noisily mkRustcDepArgs mkRustcFeatureArgs; }; buildCrate = import ./build-crate.nix { - inherit lib stdenv mkRustcDepArgs mkRustcFeatureArgs needUnstableCLI rust; + inherit lib stdenv mkRustcDepArgs mkRustcFeatureArgs needUnstableCLI; }; installCrate = import ./install-crate.nix { inherit stdenv; }; - - # Allow access to the rust attribute set from inside buildRustCrate, which - # has a parameter that shadows the name. - rustAttrs = rust; in /* The overridable pkgs.buildRustCrate function. @@ -310,7 +305,7 @@ crate_: lib.makeOverridable depsMetadata = lib.foldl' (str: dep: str + dep.metadata) "" (dependencies ++ buildDependencies); hashedMetadata = builtins.hashString "sha256" (crateName + "-" + crateVersion + "___" + toString (mkRustcFeatureArgs crateFeatures) + - "___" + depsMetadata + "___" + rustAttrs.toRustTarget stdenv.hostPlatform); + "___" + depsMetadata + "___" + stdenv.hostPlatform.rust.rustcTarget); in lib.substring 0 10 hashedMetadata; diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix index 0b28121a5b7..cf2ddbd084b 100644 --- a/pkgs/build-support/rust/build-rust-package/default.nix +++ b/pkgs/build-support/rust/build-rust-package/default.nix @@ -1,7 +1,6 @@ { lib , importCargoLock , fetchCargoTarball -, rust , stdenv , callPackage , cargoBuildHook @@ -78,13 +77,13 @@ let sha256 = args.cargoSha256; } // depsExtraArgs); - target = rust.toRustTargetSpec stdenv.hostPlatform; + target = stdenv.hostPlatform.rust.rustcTargetSpec; targetIsJSON = lib.hasSuffix ".json" target; useSysroot = targetIsJSON && !__internal_dontAddSysroot; sysroot = callPackage ./sysroot { } { inherit target; - shortTarget = rust.lib.toRustTargetSpecShort stdenv.hostPlatform; + shortTarget = stdenv.hostPlatform.rust.cargoShortTarget; RUSTFLAGS = args.RUSTFLAGS or ""; originalCargoToml = src + /Cargo.toml; # profile info is later extracted }; diff --git a/pkgs/build-support/rust/build-rust-package/sysroot/default.nix b/pkgs/build-support/rust/build-rust-package/sysroot/default.nix index a6d53056d9c..bb95b7bdc35 100644 --- a/pkgs/build-support/rust/build-rust-package/sysroot/default.nix +++ b/pkgs/build-support/rust/build-rust-package/sysroot/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, rust, rustPlatform, buildPackages }: +{ lib, stdenv, rustPlatform, buildPackages }: { shortTarget, originalCargoToml, target, RUSTFLAGS }: @@ -26,7 +26,7 @@ in rustPlatform.buildRustPackage { done export RUST_SYSROOT=$(rustc --print=sysroot) - host=${rust.toRustTarget stdenv.buildPlatform} + host=${stdenv.buildPlatform.rust.rustcTarget} cp -r $RUST_SYSROOT/lib/rustlib/$host $out ''; diff --git a/pkgs/build-support/rust/hooks/default.nix b/pkgs/build-support/rust/hooks/default.nix index 205d085d350..7703ff4abad 100644 --- a/pkgs/build-support/rust/hooks/default.nix +++ b/pkgs/build-support/rust/hooks/default.nix @@ -13,7 +13,7 @@ # This confusingly-named parameter indicates the *subdirectory of # `target/` from which to copy the build artifacts. It is derived # from a stdenv platform (or a JSON file). -, target ? rust.lib.toRustTargetSpecShort stdenv.hostPlatform +, target ? stdenv.hostPlatform.rust.cargoShortTarget }: { @@ -65,10 +65,10 @@ diff = "${lib.getBin buildPackages.diffutils}/bin/diff"; cargoConfig = '' - [target."${rust.toRustTarget stdenv.buildPlatform}"] + [target."${stdenv.buildPlatform.rust.rustcTarget}"] "linker" = "${rust.envVars.ccForBuild}" ${lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) '' - [target."${rust.toRustTarget stdenv.hostPlatform}"] + [target."${stdenv.hostPlatform.rust.rustcTarget}"] "linker" = "${rust.envVars.ccForHost}" ''} "rustflags" = [ "-C", "target-feature=${if stdenv.hostPlatform.isStatic then "+" else "-"}crt-static" ] diff --git a/pkgs/build-support/rust/lib/default.nix b/pkgs/build-support/rust/lib/default.nix index ceca7323176..dad8ab52823 100644 --- a/pkgs/build-support/rust/lib/default.nix +++ b/pkgs/build-support/rust/lib/default.nix @@ -5,89 +5,6 @@ }: rec { - # https://doc.rust-lang.org/reference/conditional-compilation.html#target_arch - toTargetArch = platform: - /**/ if platform ? rustc.platform then platform.rustc.platform.arch - else if platform.isAarch32 then "arm" - else if platform.isMips64 then "mips64" # never add "el" suffix - else if platform.isPower64 then "powerpc64" # never add "le" suffix - else platform.parsed.cpu.name; - - # https://doc.rust-lang.org/reference/conditional-compilation.html#target_os - toTargetOs = platform: - /**/ if platform ? rustc.platform then platform.rustc.platform.os or "none" - else if platform.isDarwin then "macos" - else platform.parsed.kernel.name; - - # https://doc.rust-lang.org/reference/conditional-compilation.html#target_family - toTargetFamily = platform: - if platform ? rustc.platform.target-family - then - ( - # Since https://github.com/rust-lang/rust/pull/84072 - # `target-family` is a list instead of single value. - let - f = platform.rustc.platform.target-family; - in - if builtins.isList f then f else [ f ] - ) - else lib.optional platform.isUnix "unix" - ++ lib.optional platform.isWindows "windows"; - - # https://doc.rust-lang.org/reference/conditional-compilation.html#target_vendor - toTargetVendor = platform: let - inherit (platform.parsed) vendor; - in platform.rustc.platform.vendor or { - "w64" = "pc"; - }.${vendor.name} or vendor.name; - - # Returns the name of the rust target, even if it is custom. Adjustments are - # because rust has slightly different naming conventions than we do. - toRustTarget = platform: let - inherit (platform.parsed) cpu kernel abi; - cpu_ = platform.rustc.platform.arch or { - "armv7a" = "armv7"; - "armv7l" = "armv7"; - "armv6l" = "arm"; - "armv5tel" = "armv5te"; - "riscv64" = "riscv64gc"; - }.${cpu.name} or cpu.name; - vendor_ = toTargetVendor platform; - in platform.rustc.config - or "${cpu_}-${vendor_}-${kernel.name}${lib.optionalString (abi.name != "unknown") "-${abi.name}"}"; - - # Returns the name of the rust target if it is standard, or the json file - # containing the custom target spec. - toRustTargetSpec = platform: - if platform ? rustc.platform - then builtins.toFile (toRustTarget platform + ".json") (builtins.toJSON platform.rustc.platform) - else toRustTarget platform; - - # Returns the name of the rust target if it is standard, or the - # basename of the file containing the custom target spec, without - # the .json extension. - # - # This is the name used by Cargo for target subdirectories. - toRustTargetSpecShort = platform: - lib.removeSuffix ".json" - (baseNameOf "${toRustTargetSpec platform}"); - - # When used as part of an environment variable name, triples are - # uppercased and have all hyphens replaced by underscores: - # - # https://github.com/rust-lang/cargo/pull/9169 - # https://github.com/rust-lang/cargo/issues/8285#issuecomment-634202431 - # - toRustTargetForUseInEnvVars = platform: - lib.strings.replaceStrings ["-"] ["_"] - (lib.strings.toUpper - (toRustTargetSpecShort platform)); - - # Returns true if the target is no_std - # https://github.com/rust-lang/rust/blob/2e44c17c12cec45b6a682b1e53a04ac5b5fcc9d2/src/bootstrap/config.rs#L415-L421 - IsNoStdTarget = platform: let rustTarget = toRustTarget platform; in - builtins.any (t: lib.hasInfix t rustTarget) ["-none" "nvptx" "switch" "-uefi"]; - # These environment variables must be set when using `cargo-c` and # several other tools which do not deal well with cross # compilation. The symptom of the problem they fix is errors due @@ -107,12 +24,12 @@ rec { ccForTarget = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}cc"; cxxForTarget = "${targetPackages.stdenv.cc}/bin/${targetPackages.stdenv.cc.targetPrefix}c++"; - rustBuildPlatform = toRustTarget stdenv.buildPlatform; - rustBuildPlatformSpec = toRustTargetSpec stdenv.buildPlatform; - rustHostPlatform = toRustTarget stdenv.hostPlatform; - rustHostPlatformSpec = toRustTargetSpec stdenv.hostPlatform; - rustTargetPlatform = toRustTarget stdenv.targetPlatform; - rustTargetPlatformSpec = toRustTargetSpec stdenv.targetPlatform; + rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget; + rustBuildPlatformSpec = stdenv.buildPlatform.rust.rustcTargetSpec; + rustHostPlatform = stdenv.hostPlatform.rust.rustcTarget; + rustHostPlatformSpec = stdenv.hostPlatform.rust.rustcTargetSpec; + rustTargetPlatform = stdenv.targetPlatform.rust.rustcTarget; + rustTargetPlatformSpec = stdenv.targetPlatform.rust.rustcTargetSpec; in { inherit ccForBuild cxxForBuild rustBuildPlatform rustBuildPlatformSpec @@ -131,20 +48,34 @@ rec { # the following lines when rustTargetPlatform collides with # rustHostPlatform. + lib.optionalString (rustTargetPlatform != rustHostPlatform) '' - "CC_${toRustTargetForUseInEnvVars stdenv.targetPlatform}=${ccForTarget}" \ - "CXX_${toRustTargetForUseInEnvVars stdenv.targetPlatform}=${cxxForTarget}" \ - "CARGO_TARGET_${toRustTargetForUseInEnvVars stdenv.targetPlatform}_LINKER=${ccForTarget}" \ + "CC_${stdenv.targetPlatform.rust.cargoEnvVarTarget}=${ccForTarget}" \ + "CXX_${stdenv.targetPlatform.rust.cargoEnvVarTarget}=${cxxForTarget}" \ + "CARGO_TARGET_${stdenv.targetPlatform.rust.cargoEnvVarTarget}_LINKER=${ccForTarget}" \ '' + '' - "CC_${toRustTargetForUseInEnvVars stdenv.hostPlatform}=${ccForHost}" \ - "CXX_${toRustTargetForUseInEnvVars stdenv.hostPlatform}=${cxxForHost}" \ - "CARGO_TARGET_${toRustTargetForUseInEnvVars stdenv.hostPlatform}_LINKER=${ccForHost}" \ + "CC_${stdenv.hostPlatform.rust.cargoEnvVarTarget}=${ccForHost}" \ + "CXX_${stdenv.hostPlatform.rust.cargoEnvVarTarget}=${cxxForHost}" \ + "CARGO_TARGET_${stdenv.hostPlatform.rust.cargoEnvVarTarget}_LINKER=${ccForHost}" \ '' + '' - "CC_${toRustTargetForUseInEnvVars stdenv.buildPlatform}=${ccForBuild}" \ - "CXX_${toRustTargetForUseInEnvVars stdenv.buildPlatform}=${cxxForBuild}" \ - "CARGO_TARGET_${toRustTargetForUseInEnvVars stdenv.buildPlatform}_LINKER=${ccForBuild}" \ + "CC_${stdenv.buildPlatform.rust.cargoEnvVarTarget}=${ccForBuild}" \ + "CXX_${stdenv.buildPlatform.rust.cargoEnvVarTarget}=${cxxForBuild}" \ + "CARGO_TARGET_${stdenv.buildPlatform.rust.cargoEnvVarTarget}_LINKER=${ccForBuild}" \ "CARGO_BUILD_TARGET=${rustBuildPlatform}" \ "HOST_CC=${buildPackages.stdenv.cc}/bin/cc" \ "HOST_CXX=${buildPackages.stdenv.cc}/bin/c++" \ ''; }; +} // lib.mapAttrs (old: new: platform: + # TODO: enable warning after 23.05 is EOL. + # lib.warn "`rust.${old} platform` is deprecated. Use `platform.rust.${new}` instead." + lib.getAttrFromPath new platform.rust) +{ + toTargetArch = [ "platform" "arch" ]; + toTargetOs = [ "platform" "os" ]; + toTargetFamily = [ "platform" "target-family" ]; + toTargetVendor = [ "platform" "vendor" ]; + toRustTarget = [ "rustcTarget" ]; + toRustTargetSpec = [ "rustcTargetSpec" ]; + toRustTargetSpecShort = [ "cargoShortTarget" ]; + toRustTargetForUseInEnvVars = [ "cargoEnvVarTarget" ]; + IsNoStdTarget = [ "isNoStdTarget" ]; } diff --git a/pkgs/desktops/gnome/core/gnome-tour/default.nix b/pkgs/desktops/gnome/core/gnome-tour/default.nix index c471417d616..26ac73f546d 100644 --- a/pkgs/desktops/gnome/core/gnome-tour/default.nix +++ b/pkgs/desktops/gnome/core/gnome-tour/default.nix @@ -17,7 +17,6 @@ , libadwaita , librsvg , rustc -, rust , writeText , cargo }: @@ -65,7 +64,7 @@ stdenv.mkDerivation rec { # ERROR: 'rust' compiler binary not defined in cross or native file crossFile = writeText "cross-file.conf" '' [binaries] - rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ] + rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ] ''; in lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ]; diff --git a/pkgs/development/compilers/mrustc/bootstrap.nix b/pkgs/development/compilers/mrustc/bootstrap.nix index a8bf26bacdf..0996702ec62 100644 --- a/pkgs/development/compilers/mrustc/bootstrap.nix +++ b/pkgs/development/compilers/mrustc/bootstrap.nix @@ -2,7 +2,6 @@ , fetchurl , mrustc , mrustc-minicargo -, rust , llvm_12 , llvmPackages_12 , libffi @@ -74,7 +73,7 @@ stdenv.mkDerivation rec { "MRUSTC=${mrustc}/bin/mrustc" #"MINICARGO=${mrustc-minicargo}/bin/minicargo" # FIXME: we need to rebuild minicargo locally so --manifest-overrides is applied "LLVM_CONFIG=${llvm_12.dev}/bin/llvm-config" - "RUSTC_TARGET=${rust.toRustTarget stdenv.targetPlatform}" + "RUSTC_TARGET=${stdenv.targetPlatform.rust.rustcTarget}" ]; buildPhase = '' @@ -129,7 +128,7 @@ stdenv.mkDerivation rec { cp run_rustc/${outputDir}/prefix/bin/rustc_binary $out/bin/rustc cp -r run_rustc/${outputDir}/prefix/lib/* $out/lib/ - cp $out/lib/rustlib/${rust.toRustTarget stdenv.targetPlatform}/lib/*.so $out/lib/ + cp $out/lib/rustlib/${stdenv.targetPlatform.rust.rustcTarget}/lib/*.so $out/lib/ runHook postInstall ''; @@ -146,4 +145,3 @@ stdenv.mkDerivation rec { platforms = [ "x86_64-linux" ]; }; } - diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix index 7c0b46d5593..97ac6927025 100644 --- a/pkgs/development/compilers/rust/bootstrap.nix +++ b/pkgs/development/compilers/rust/bootstrap.nix @@ -1,7 +1,7 @@ -{ stdenv, fetchurl, rust, callPackage, version, hashes }: +{ stdenv, fetchurl, callPackage, version, hashes }: let - platform = rust.toRustTarget stdenv.hostPlatform; + platform = stdenv.hostPlatform.rust.rustcTarget; src = fetchurl { url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz"; diff --git a/pkgs/development/compilers/rust/cargo.nix b/pkgs/development/compilers/rust/cargo.nix index 46e238ff479..8eb628aa536 100644 --- a/pkgs/development/compilers/rust/cargo.nix +++ b/pkgs/development/compilers/rust/cargo.nix @@ -1,6 +1,6 @@ { lib, stdenv, pkgsBuildHost, pkgsHostHost , file, curl, pkg-config, python3, openssl, cmake, zlib -, installShellFiles, makeWrapper, rustPlatform, rust, rustc +, installShellFiles, makeWrapper, rustPlatform, rustc , CoreFoundation, Security , auditable ? !cargo-auditable.meta.broken , cargo-auditable @@ -116,6 +116,6 @@ rustPlatform.buildRustPackage.override { broken = stdenv.hostPlatform.isx86 && stdenv.buildPlatform != stdenv.hostPlatform; }; } -// lib.optionalAttrs (rust.toRustTarget stdenv.buildPlatform != rust.toRustTarget stdenv.hostPlatform) { +// lib.optionalAttrs (stdenv.buildPlatform.rust.rustcTarget != stdenv.hostPlatform.rust.rustcTarget) { HOST_PKG_CONFIG_PATH="${pkgsBuildBuild.pkg-config}/bin/pkg-config"; }) diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 44c290acbd3..5f97b0f4019 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -1,7 +1,7 @@ { lib, stdenv, removeReferencesTo, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, targetPackages , llvmShared, llvmSharedForBuild, llvmSharedForHost, llvmSharedForTarget, llvmPackages , fetchurl, file, python3 -, darwin, cargo, cmake, rust, rustc +, darwin, cargo, cmake, rustc , pkg-config, openssl, xz , libiconv , which, libffi @@ -51,7 +51,7 @@ in stdenv.mkDerivation rec { # but it does support checking these idiosyncratic PKG_CONFIG_${TRIPLE} # environment variables. # [1]: https://github.com/rust-lang/pkg-config-rs/issues/53 - "PKG_CONFIG_${builtins.replaceStrings ["-"] ["_"] (rust.toRustTarget stdenv.buildPlatform)}" = + "PKG_CONFIG_${builtins.replaceStrings ["-"] ["_"] stdenv.buildPlatform.rust.rustcTarget}" = "${pkgsBuildHost.stdenv.cc.targetPrefix}pkg-config"; NIX_LDFLAGS = toString ( @@ -69,9 +69,9 @@ in stdenv.mkDerivation rec { prefixForStdenv = stdenv: "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}"; ccPrefixForStdenv = stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang" else "cc"}"; cxxPrefixForStdenv = stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang++" else "c++"}"; - setBuild = "--set=target.${rust.toRustTarget stdenv.buildPlatform}"; - setHost = "--set=target.${rust.toRustTarget stdenv.hostPlatform}"; - setTarget = "--set=target.${rust.toRustTarget stdenv.targetPlatform}"; + setBuild = "--set=target.${stdenv.buildPlatform.rust.rustcTarget}"; + setHost = "--set=target.${stdenv.hostPlatform.rust.rustcTarget}"; + setTarget = "--set=target.${stdenv.targetPlatform.rust.rustcTarget}"; ccForBuild = ccPrefixForStdenv pkgsBuildBuild.targetPackages.stdenv; cxxForBuild = cxxPrefixForStdenv pkgsBuildBuild.targetPackages.stdenv; ccForHost = ccPrefixForStdenv pkgsBuildHost.targetPackages.stdenv; @@ -85,23 +85,23 @@ in stdenv.mkDerivation rec { "--tools=rustc,rust-analyzer-proc-macro-srv" "--enable-rpath" "--enable-vendor" - "--build=${rust.toRustTargetSpec stdenv.buildPlatform}" - "--host=${rust.toRustTargetSpec stdenv.hostPlatform}" + "--build=${stdenv.buildPlatform.rust.rustcTargetSpec}" + "--host=${stdenv.hostPlatform.rust.rustcTargetSpec}" # std is built for all platforms in --target. "--target=${concatStringsSep "," ([ - (rust.toRustTargetSpec stdenv.targetPlatform) + stdenv.targetPlatform.rust.rustcTargetSpec # (build!=target): When cross-building a compiler we need to add # the build platform as well so rustc can compile build.rs # scripts. ] ++ optionals (stdenv.buildPlatform != stdenv.targetPlatform && !fastCross) [ - (rust.toRustTargetSpec stdenv.buildPlatform) + stdenv.buildPlatform.rust.rustcTargetSpec # (host!=target): When building a cross-targeting compiler we # need to add the host platform as well so rustc can compile # build.rs scripts. ] ++ optionals (stdenv.hostPlatform != stdenv.targetPlatform && !fastCross) [ - (rust.toRustTargetSpec stdenv.hostPlatform) + stdenv.hostPlatform.rust.rustcTargetSpec ])}" "${setBuild}.cc=${ccForBuild}" @@ -132,7 +132,7 @@ in stdenv.mkDerivation rec { "${setHost}.musl-root=${pkgsBuildHost.targetPackages.stdenv.cc.libc}" ] ++ optionals stdenv.targetPlatform.isMusl [ "${setTarget}.musl-root=${pkgsBuildTarget.targetPackages.stdenv.cc.libc}" - ] ++ optionals (rust.IsNoStdTarget stdenv.targetPlatform) [ + ] ++ optionals stdenv.targetPlatform.rust.isNoStdTarget [ "--disable-docs" ] ++ optionals (stdenv.isDarwin && stdenv.isx86_64) [ # https://github.com/rust-lang/rust/issues/92173 @@ -144,12 +144,12 @@ in stdenv.mkDerivation rec { buildPhase = if fastCross then " runHook preBuild - mkdir -p build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-{std,rustc}/${rust.toRustTargetSpec stdenv.hostPlatform}/release/ - ln -s ${rustc}/lib/rustlib/${rust.toRustTargetSpec stdenv.hostPlatform}/libstd-*.so build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-std/${rust.toRustTargetSpec stdenv.hostPlatform}/release/libstd.so - ln -s ${rustc}/lib/rustlib/${rust.toRustTargetSpec stdenv.hostPlatform}/librustc_driver-*.so build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-rustc/${rust.toRustTargetSpec stdenv.hostPlatform}/release/librustc.so - ln -s ${rustc}/bin/rustc build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-rustc/${rust.toRustTargetSpec stdenv.hostPlatform}/release/rustc-main - touch build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-std/${rust.toRustTargetSpec stdenv.hostPlatform}/release/.libstd.stamp - touch build/${rust.toRustTargetSpec stdenv.hostPlatform}/stage0-rustc/${rust.toRustTargetSpec stdenv.hostPlatform}/release/.librustc.stamp + mkdir -p build/${stdenv.hostPlatform.rust.rustcTargetSpec}/stage0-{std,rustc}/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/ + ln -s ${rustc}/lib/rustlib/${stdenv.hostPlatform.rust.rustcTargetSpec}/libstd-*.so build/${stdenv.hostPlatform.rust.rustcTargetSpec}/stage0-std/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/libstd.so + ln -s ${rustc}/lib/rustlib/${stdenv.hostPlatform.rust.rustcTargetSpec}/librustc_driver-*.so build/${stdenv.hostPlatform.rust.rustcTargetSpec}/stage0-rustc/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/librustc.so + ln -s ${rustc}/bin/rustc build/${stdenv.hostPlatform.rust.rustcTargetSpec}/stage0-rustc/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/rustc-main + touch build/${stdenv.hostPlatform.rust.rustcTargetSpec}/stage0-std/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/.libstd.stamp + touch build/${stdenv.hostPlatform.rust.rustcTargetSpec}/stage0-rustc/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/.librustc.stamp python ./x.py --keep-stage=0 --stage=1 build library/std runHook postBuild @@ -162,8 +162,8 @@ in stdenv.mkDerivation rec { mkdir -v $out/bin $doc $man makeWrapper ${rustc}/bin/rustc $out/bin/rustc --add-flags "--sysroot $out" makeWrapper ${rustc}/bin/rustdoc $out/bin/rustdoc --add-flags "--sysroot $out" - ln -s ${rustc}/lib/rustlib/{manifest-rust-std-,}${rust.toRustTargetSpec stdenv.hostPlatform} $out/lib/rustlib/ - echo rust-std-${rust.toRustTargetSpec stdenv.hostPlatform} >> $out/lib/rustlib/components + ln -s ${rustc}/lib/rustlib/{manifest-rust-std-,}${stdenv.hostPlatform.rust.rustcTargetSpec} $out/lib/rustlib/ + echo rust-std-${stdenv.hostPlatform.rust.rustcTargetSpec} >> $out/lib/rustlib/components lndir ${rustc.doc} $doc lndir ${rustc.man} $man diff --git a/pkgs/development/interpreters/python/hooks/default.nix b/pkgs/development/interpreters/python/hooks/default.nix index a907cda5f11..f7cc10274ae 100644 --- a/pkgs/development/interpreters/python/hooks/default.nix +++ b/pkgs/development/interpreters/python/hooks/default.nix @@ -183,16 +183,14 @@ in { }; } ./setuptools-check-hook.sh) {}; - setuptoolsRustBuildHook = callPackage ({ makePythonHook, setuptools-rust, rust }: + setuptoolsRustBuildHook = callPackage ({ makePythonHook, setuptools-rust }: makePythonHook { name = "setuptools-rust-setup-hook"; propagatedBuildInputs = [ setuptools-rust ]; substitutions = { pyLibDir = "${python}/lib/${python.libPrefix}"; - cargoBuildTarget = rust.toRustTargetSpec stdenv.hostPlatform; - cargoLinkerVar = lib.toUpper ( - builtins.replaceStrings ["-"] ["_"] ( - rust.toRustTarget stdenv.hostPlatform)); + cargoBuildTarget = stdenv.hostPlatform.rust.rustcTargetSpec; + cargoLinkerVar = stdenv.hostPlatform.rust.cargoEnvVarTarget; targetLinker = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; }; } ./setuptools-rust-hook.sh) {}; diff --git a/pkgs/development/libraries/gstreamer/rs/default.nix b/pkgs/development/libraries/gstreamer/rs/default.nix index e0d324936dd..1d06f880959 100644 --- a/pkgs/development/libraries/gstreamer/rs/default.nix +++ b/pkgs/development/libraries/gstreamer/rs/default.nix @@ -8,7 +8,6 @@ , ninja , python3 , pkg-config -, rust , rustc , cargo , cargo-c @@ -208,7 +207,7 @@ stdenv.mkDerivation rec { ] ++ (let crossFile = writeText "cross-file.conf" '' [binaries] - rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ] + rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ] ''; in lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "--cross-file=${crossFile}" diff --git a/pkgs/development/libraries/libdovi/default.nix b/pkgs/development/libraries/libdovi/default.nix index cf1a9a561f3..c70a217f6fc 100644 --- a/pkgs/development/libraries/libdovi/default.nix +++ b/pkgs/development/libraries/libdovi/default.nix @@ -5,9 +5,7 @@ , rust , stdenv }: -let - rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform; -in + rustPlatform.buildRustPackage rec { pname = "libdovi"; version = "3.1.2"; @@ -28,19 +26,19 @@ rustPlatform.buildRustPackage rec { buildPhase = '' runHook preBuild - ${rust.envVars.setEnv} cargo cbuild -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec} + ${rust.envVars.setEnv} cargo cbuild -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} runHook postBuild ''; installPhase = '' runHook preInstall - ${rust.envVars.setEnv} cargo cinstall -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec} + ${rust.envVars.setEnv} cargo cinstall -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} runHook postInstall ''; checkPhase = '' runHook preCheck - ${rust.envVars.setEnv} cargo ctest -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec} + ${rust.envVars.setEnv} cargo ctest -j $NIX_BUILD_CORES --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} runHook postCheck ''; diff --git a/pkgs/development/libraries/libimagequant/default.nix b/pkgs/development/libraries/libimagequant/default.nix index 0ac6e89e23e..f60a1c7cab7 100644 --- a/pkgs/development/libraries/libimagequant/default.nix +++ b/pkgs/development/libraries/libimagequant/default.nix @@ -1,8 +1,5 @@ { lib, stdenv, fetchFromGitHub, fetchurl, rust, rustPlatform, cargo-c, python3 }: -let - rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform; -in rustPlatform.buildRustPackage rec { pname = "libimagequant"; version = "4.2.2"; @@ -26,13 +23,13 @@ rustPlatform.buildRustPackage rec { postBuild = '' pushd imagequant-sys - ${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec} + ${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} popd ''; postInstall = '' pushd imagequant-sys - ${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec} + ${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} popd ''; diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix index a0843d4b2ef..7ba6f1963e7 100644 --- a/pkgs/development/libraries/librsvg/default.nix +++ b/pkgs/development/libraries/librsvg/default.nix @@ -15,7 +15,6 @@ , libobjc , rustPlatform , rustc -, rust , cargo-auditable-cargo-wrapper , gi-docgen , python3Packages @@ -106,7 +105,7 @@ stdenv.mkDerivation (finalAttrs: { "--enable-always-build-tests" ] ++ lib.optional stdenv.isDarwin "--disable-Bsymbolic" - ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "RUST_TARGET=${rust.toRustTarget stdenv.hostPlatform}"; + ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "RUST_TARGET=${stdenv.hostPlatform.rust.rustcTarget}"; doCheck = false; # all tests fail on libtool-generated rsvg-convert not being able to find coreutils diff --git a/pkgs/development/libraries/relibc/default.nix b/pkgs/development/libraries/relibc/default.nix index 28ed971a25e..3bc476ccc0f 100644 --- a/pkgs/development/libraries/relibc/default.nix +++ b/pkgs/development/libraries/relibc/default.nix @@ -64,7 +64,7 @@ redoxRustPlatform.buildRustPackage rec { ''; # TODO: should be hostPlatform - TARGET = buildPackages.rust.toRustTargetSpec stdenvNoCC.targetPlatform; + TARGET = stdenvNoCC.targetPlatform.rust.rustcTargetSpec; cargoLock = { lockFile = ./Cargo.lock; diff --git a/pkgs/development/libraries/rustc-demangle/default.nix b/pkgs/development/libraries/rustc-demangle/default.nix index 6dd6d46e30b..4e142c58452 100644 --- a/pkgs/development/libraries/rustc-demangle/default.nix +++ b/pkgs/development/libraries/rustc-demangle/default.nix @@ -1,4 +1,4 @@ -{ rustPlatform, fetchFromGitHub, rust, lib, stdenv }: +{ rustPlatform, fetchFromGitHub, lib, stdenv }: rustPlatform.buildRustPackage rec { pname = "rustc-demangle"; @@ -24,7 +24,7 @@ rustPlatform.buildRustPackage rec { postInstall = '' mkdir -p $out/lib - cp target/${rust.toRustTargetSpec stdenv.hostPlatform}/release/librustc_demangle.so $out/lib + cp target/${stdenv.hostPlatform.rust.rustcTargetSpec}/release/librustc_demangle.so $out/lib cp -R crates/capi/include $out ''; diff --git a/pkgs/development/tools/lalrpop/default.nix b/pkgs/development/tools/lalrpop/default.nix index 0bc8bddefbd..32e6ec7a35b 100644 --- a/pkgs/development/tools/lalrpop/default.nix +++ b/pkgs/development/tools/lalrpop/default.nix @@ -1,6 +1,5 @@ { lib , rustPlatform -, rust , fetchFromGitHub , substituteAll , stdenv @@ -24,7 +23,7 @@ rustPlatform.buildRustPackage rec { patches = [ (substituteAll { src = ./use-correct-binary-path-in-tests.patch; - target_triple = rust.toRustTarget stdenv.hostPlatform; + target_triple = stdenv.hostPlatform.rust.rustcTarget; }) ]; diff --git a/pkgs/development/tools/rust/cargo-benchcmp/default.nix b/pkgs/development/tools/rust/cargo-benchcmp/default.nix index 4aa3c411f12..d46a57355d7 100644 --- a/pkgs/development/tools/rust/cargo-benchcmp/default.nix +++ b/pkgs/development/tools/rust/cargo-benchcmp/default.nix @@ -2,7 +2,6 @@ , rustPlatform , fetchFromGitHub , substituteAll -, rust , stdenv }: @@ -23,7 +22,7 @@ rustPlatform.buildRustPackage rec { # patch the binary path so tests can find the binary when `--target` is present (substituteAll { src = ./fix-test-binary-path.patch; - shortTarget = rust.toRustTarget stdenv.hostPlatform; + shortTarget = stdenv.hostPlatform.rust.rustcTarget; }) ]; diff --git a/pkgs/development/tools/rust/cargo-watch/default.nix b/pkgs/development/tools/rust/cargo-watch/default.nix index fda47b5070a..63217b655ac 100644 --- a/pkgs/development/tools/rust/cargo-watch/default.nix +++ b/pkgs/development/tools/rust/cargo-watch/default.nix @@ -5,7 +5,6 @@ , Cocoa , CoreServices , Foundation -, rust , libiconv }: @@ -27,7 +26,7 @@ rustPlatform.buildRustPackage rec { # `test with_cargo` tries to call cargo-watch as a cargo subcommand # (calling cargo-watch with command `cargo watch`) preCheck = '' - export PATH="$(pwd)/target/${rust.toRustTarget stdenv.hostPlatform}/release:$PATH" + export PATH="$(pwd)/target/${stdenv.hostPlatform.rust.rustcTarget}/release:$PATH" ''; meta = with lib; { diff --git a/pkgs/development/web/deno/librusty_v8.nix b/pkgs/development/web/deno/librusty_v8.nix index 20fd20a5b98..e4d2a2fec70 100644 --- a/pkgs/development/web/deno/librusty_v8.nix +++ b/pkgs/development/web/deno/librusty_v8.nix @@ -1,11 +1,10 @@ # auto-generated file -- DO NOT EDIT! -{ rust, stdenv, fetchurl }: +{ stdenv, fetchurl }: let - arch = rust.toRustTarget stdenv.hostPlatform; fetch_librusty_v8 = args: fetchurl { name = "librusty_v8-${args.version}"; - url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${arch}.a"; + url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a"; sha256 = args.shas.${stdenv.hostPlatform.system}; meta = { inherit (args) version; }; }; diff --git a/pkgs/development/web/deno/update/librusty_v8.ts b/pkgs/development/web/deno/update/librusty_v8.ts index b38e0a28f1a..39831f6ea27 100644 --- a/pkgs/development/web/deno/update/librusty_v8.ts +++ b/pkgs/development/web/deno/update/librusty_v8.ts @@ -40,13 +40,12 @@ fetchurl { const templateDeps = (version: string, deps: PrefetchResult[]) => `# auto-generated file -- DO NOT EDIT! -{ rust, stdenv, fetchurl }: +{ stdenv, fetchurl }: let - arch = rust.toRustTarget stdenv.hostPlatform; fetch_librusty_v8 = args: fetchurl { name = "librusty_v8-\${args.version}"; - url = "https://github.com/denoland/rusty_v8/releases/download/v\${args.version}/librusty_v8_release_\${arch}.a"; + url = "https://github.com/denoland/rusty_v8/releases/download/v\${args.version}/librusty_v8_release_\${stdenv.hostPlatform.rust.rustcTarget}.a"; sha256 = args.shas.\${stdenv.hostPlatform.system}; meta = { inherit (args) version; }; }; diff --git a/pkgs/development/web/edge-runtime/librusty_v8.nix b/pkgs/development/web/edge-runtime/librusty_v8.nix index 6e9fc0a669f..1e0a306c13b 100644 --- a/pkgs/development/web/edge-runtime/librusty_v8.nix +++ b/pkgs/development/web/edge-runtime/librusty_v8.nix @@ -1,11 +1,10 @@ # auto-generated file -- DO NOT EDIT! -{ rust, stdenv, fetchurl }: +{ stdenv, fetchurl }: let - arch = rust.toRustTarget stdenv.hostPlatform; fetch_librusty_v8 = args: fetchurl { name = "librusty_v8-${args.version}"; - url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${arch}.a"; + url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a"; sha256 = args.shas.${stdenv.hostPlatform.system}; meta = { inherit (args) version; }; }; diff --git a/pkgs/servers/http/router/librusty_v8.nix b/pkgs/servers/http/router/librusty_v8.nix index 60c6b4caef8..3e3bf55c757 100644 --- a/pkgs/servers/http/router/librusty_v8.nix +++ b/pkgs/servers/http/router/librusty_v8.nix @@ -1,10 +1,9 @@ -{ rust, stdenv, fetchurl }: +{ stdenv, fetchurl }: let - arch = rust.toRustTarget stdenv.hostPlatform; fetch_librusty_v8 = args: fetchurl { name = "librusty_v8-${args.version}"; - url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${arch}.a"; + url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a"; sha256 = args.shas.${stdenv.hostPlatform.system}; meta = { inherit (args) version; }; }; diff --git a/pkgs/servers/matrix-synapse/matrix-hookshot/default.nix b/pkgs/servers/matrix-synapse/matrix-hookshot/default.nix index 99b28a4defa..6113bd6ff41 100644 --- a/pkgs/servers/matrix-synapse/matrix-hookshot/default.nix +++ b/pkgs/servers/matrix-synapse/matrix-hookshot/default.nix @@ -5,7 +5,6 @@ , makeWrapper , matrix-sdk-crypto-nodejs , mkYarnPackage -, rust , cargo , rustPlatform , rustc @@ -60,7 +59,7 @@ mkYarnPackage rec { buildPhase = '' runHook preBuild cd deps/${pname} - napi build --target ${rust.toRustTargetSpec stdenv.targetPlatform} --dts ../src/libRs.d.ts --release ./lib + napi build --target ${stdenv.targetPlatform.rust.rustcTargetSpec} --dts ../src/libRs.d.ts --release ./lib yarn run build:app:fix-defs yarn run build:app yarn run build:web diff --git a/pkgs/servers/windmill/default.nix b/pkgs/servers/windmill/default.nix index 6b822ade08b..a10610ea195 100644 --- a/pkgs/servers/windmill/default.nix +++ b/pkgs/servers/windmill/default.nix @@ -16,7 +16,6 @@ , pixman , pkg-config , python3 -, rust , rustfmt , stdenv , swagger-cli @@ -70,11 +69,10 @@ rustPlatform.buildRustPackage { SQLX_OFFLINE = "true"; RUSTY_V8_ARCHIVE = let - arch = rust.toRustTarget stdenv.hostPlatform; fetch_librusty_v8 = args: fetchurl { name = "librusty_v8-${args.version}"; - url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${arch}.a"; + url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a"; sha256 = args.shas.${stdenv.hostPlatform.system} or (throw "Unsupported platform ${stdenv.hostPlatform.system}"); meta = { inherit (args) version; }; }; diff --git a/pkgs/tools/misc/halp/default.nix b/pkgs/tools/misc/halp/default.nix index d9028a8392a..89867fe7a94 100644 --- a/pkgs/tools/misc/halp/default.nix +++ b/pkgs/tools/misc/halp/default.nix @@ -5,7 +5,6 @@ , stdenv , darwin , unixtools -, rust }: rustPlatform.buildRustPackage rec { @@ -48,7 +47,7 @@ rustPlatform.buildRustPackage rec { postPatch = '' substituteInPlace src/helper/args/mod.rs \ - --subst-var-by releaseDir target/${rust.toRustTargetSpec stdenv.hostPlatform}/$cargoCheckType + --subst-var-by releaseDir target/${stdenv.hostPlatform.rust.rustcTargetSpec}/$cargoCheckType ''; preCheck = '' diff --git a/pkgs/tools/system/zram-generator/default.nix b/pkgs/tools/system/zram-generator/default.nix index 81bf4082d5c..3d55d7c1961 100644 --- a/pkgs/tools/system/zram-generator/default.nix +++ b/pkgs/tools/system/zram-generator/default.nix @@ -1,7 +1,6 @@ { lib , stdenv , fetchFromGitHub -, rust , rustPlatform , pkg-config , ronn @@ -28,7 +27,7 @@ rustPlatform.buildRustPackage rec { postPatch = '' cp ${./Cargo.lock} Cargo.lock substituteInPlace Makefile \ - --replace 'target/$(BUILDTYPE)' 'target/${rust.toRustTargetSpec stdenv.hostPlatform}/$(BUILDTYPE)' + --replace 'target/$(BUILDTYPE)' 'target/${stdenv.hostPlatform.rust.rustcTargetSpec}/$(BUILDTYPE)' substituteInPlace src/generator.rs \ --replace 'Command::new("systemd-detect-virt")' 'Command::new("${systemd}/bin/systemd-detect-virt")' \ --replace 'Command::new("modprobe")' 'Command::new("${kmod}/bin/modprobe")' diff --git a/pkgs/tools/video/rav1e/default.nix b/pkgs/tools/video/rav1e/default.nix index 70e95cb4f01..146ff607254 100644 --- a/pkgs/tools/video/rav1e/default.nix +++ b/pkgs/tools/video/rav1e/default.nix @@ -13,10 +13,7 @@ , buildPackages }: -let - rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform; - -in rustPlatform.buildRustPackage rec { +rustPlatform.buildRustPackage rec { pname = "rav1e"; version = "0.6.6"; @@ -47,11 +44,11 @@ in rustPlatform.buildRustPackage rec { checkType = "debug"; postBuild = '' - ${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec} + ${rust.envVars.setEnv} cargo cbuild --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} ''; postInstall = '' - ${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${rustTargetPlatformSpec} + ${rust.envVars.setEnv} cargo cinstall --release --frozen --prefix=${placeholder "out"} --target ${stdenv.hostPlatform.rust.rustcTarget} ''; meta = with lib; { -- cgit 1.4.1 From 506dcaabb4e004ed5db214f7efbbc278e89f6212 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Tue, 9 May 2023 13:43:23 +0000 Subject: stdenv: fix meson rust cross compilation --- pkgs/desktops/gnome/core/gnome-tour/default.nix | 11 ----------- pkgs/development/libraries/gstreamer/rs/default.nix | 10 +--------- pkgs/stdenv/generic/make-derivation.nix | 2 ++ 3 files changed, 3 insertions(+), 20 deletions(-) (limited to 'pkgs/development/libraries/gstreamer') diff --git a/pkgs/desktops/gnome/core/gnome-tour/default.nix b/pkgs/desktops/gnome/core/gnome-tour/default.nix index 26ac73f546d..bb658fcd448 100644 --- a/pkgs/desktops/gnome/core/gnome-tour/default.nix +++ b/pkgs/desktops/gnome/core/gnome-tour/default.nix @@ -17,7 +17,6 @@ , libadwaita , librsvg , rustc -, writeText , cargo }: @@ -59,16 +58,6 @@ stdenv.mkDerivation rec { librsvg ]; - mesonFlags = - let - # ERROR: 'rust' compiler binary not defined in cross or native file - crossFile = writeText "cross-file.conf" '' - [binaries] - rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ] - ''; - in - lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ]; - passthru = { updateScript = gnome.updateScript { packageName = pname; diff --git a/pkgs/development/libraries/gstreamer/rs/default.nix b/pkgs/development/libraries/gstreamer/rs/default.nix index 1d06f880959..ee467f965c8 100644 --- a/pkgs/development/libraries/gstreamer/rs/default.nix +++ b/pkgs/development/libraries/gstreamer/rs/default.nix @@ -2,7 +2,6 @@ , stdenv , fetchFromGitLab , fetchpatch -, writeText , rustPlatform , meson , ninja @@ -204,14 +203,7 @@ stdenv.mkDerivation rec { ) ++ [ (lib.mesonOption "sodium-source" "system") (lib.mesonEnable "doc" enableDocumentation) - ] ++ (let - crossFile = writeText "cross-file.conf" '' - [binaries] - rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ] - ''; - in lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ - "--cross-file=${crossFile}" - ]); + ]; # turn off all auto plugins since we use a list of plugins we generate mesonAutoFeatures = "disabled"; diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index d235ffefaab..bd0d85fc676 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -402,6 +402,7 @@ else let crossFile = builtins.toFile "cross-file.conf" '' [properties] + bindgen_clang_arguments = ['-target', '${stdenv.targetPlatform.config}'] needs_exe_wrapper = ${lib.boolToString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform)} [host_machine] @@ -412,6 +413,7 @@ else let [binaries] llvm-config = 'llvm-config-native' + rust = ['rustc', '--target', '${stdenv.targetPlatform.rust.rustcTargetSpec}'] ''; crossFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ]; in crossFlags ++ mesonFlags; -- cgit 1.4.1