From 884435fe2104653feb55ef7b4d23df6f6b466ed2 Mon Sep 17 00:00:00 2001 From: Colin Date: Wed, 11 Sep 2024 01:25:15 +0000 Subject: [PATCH] refactor: remove uses of deprecated "rust.toRustTarget" --- overlays/cross.nix | 39 +++++-------- .../flare-signal-nixified/default.nix | 49 +++++++--------- pkgs/additional/fractal-nixified/default.nix | 58 +++++++++---------- .../additional/newsflash-nixified/default.nix | 18 +----- 4 files changed, 67 insertions(+), 97 deletions(-) diff --git a/overlays/cross.nix b/overlays/cross.nix index c81344ad8..c3a47aca8 100644 --- a/overlays/cross.nix +++ b/overlays/cross.nix @@ -312,9 +312,9 @@ in with final; { # cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; # ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; # cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; - # rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform; - # rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; - # rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform; + # rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget; + # rustTargetPlatform = stdenv.hostPlatform.rust.rustcTarget; + # rustTargetPlatformSpec = stdenv.hostPlatform.rust.rustcTargetSpec; # in { # # taken from # # fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option ‘-m64’" @@ -599,16 +599,12 @@ in with final; { # ]; # }); - lemoa = (prev.lemoa.override { cargo = crossCargo; }).overrideAttrs (upstream: - let - rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; - in { - preBuild = '' - mkdir -p target/release - ln -s ../${rustTargetPlatform}/release/lemoa target/release/lemoa - ''; - } - ); + lemoa = (prev.lemoa.override { cargo = crossCargo; }).overrideAttrs (upstream: { + preBuild = '' + mkdir -p target/release + ln -s ../${stdenv.hostPlatform.rust.rustcTarget}/release/lemoa target/release/lemoa + ''; + }); # libgweather = prev.libgweather.overrideAttrs (upstream: { # nativeBuildInputs = (lib.remove gobject-introspection upstream.nativeBuildInputs) ++ [ @@ -784,7 +780,7 @@ in with final; { postPatch = (upstream.postPatch or "") + '' substituteInPlace src/meson.build --replace-fail \ "'src' / rust_target" \ - "'src' / '${rust.toRustTarget stdenv.hostPlatform}' / rust_target" + "'src' / '${stdenv.hostPlatform.rust.rustcTarget}' / rust_target" rm build.rs @@ -800,14 +796,12 @@ in with final; { ''; env = let - inherit buildPackages stdenv rust; ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; - rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform; - rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; - rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform; + rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget; + rustTargetPlatform = stdenv.hostPlatform.rust.rustcTarget; in (upstream.env or {}) // { # taken from # fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option ‘-m64’" @@ -948,14 +942,11 @@ in with final; { # 2024/09/01: upstreaming is unblocked pwvucontrol = (prev.pwvucontrol.override { cargo = crossCargo; - }).overrideAttrs (upstream: - let - rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; - in { + }).overrideAttrs (upstream: { postPatch = (upstream.postPatch or "") + '' substituteInPlace src/meson.build --replace-fail \ "'src' / rust_target" \ - "'src' / '${rustTargetPlatform}' / rust_target" + "'src' / '${stdenv.hostPlatform.rust.rustcTarget}' / rust_target" ''; }); @@ -1103,7 +1094,7 @@ in with final; { # # 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 # # upstream.mesonFlags or [] ++ diff --git a/pkgs/additional/flare-signal-nixified/default.nix b/pkgs/additional/flare-signal-nixified/default.nix index c47852d6c..00944d90c 100644 --- a/pkgs/additional/flare-signal-nixified/default.nix +++ b/pkgs/additional/flare-signal-nixified/default.nix @@ -12,33 +12,26 @@ # - link to signald JMP.chat: NO (http 405) # - primary device via JMP.chat: NO (http 422) # - link to iOS tel: NO (http 405) -{ lib -, appstream-glib -, blueprint-compiler -, buildPackages -, defaultCrateOverrides -, desktop-file-utils -, fetchFromGitLab -, flare-signal -, gdk-pixbuf -, glib -, gobject-introspection -, gst_all_1 -, gtk4 -, gtksourceview5 -, libadwaita -, libsecret -, libspelling -, meson -, ninja -, pkg-config -, pkgs -, protobuf -, rust -, stdenv -, wrapGAppsHook4 -, writeText -, crateOverrideFn ? x: x +{ + appstream-glib, + blueprint-compiler, + defaultCrateOverrides, + desktop-file-utils, + fetchFromGitLab, + gst_all_1, + gtk4, + gtksourceview5, + lib, + libadwaita, + meson, + ninja, + pkg-config, + pkgs, + protobuf, + stdenv, + wrapGAppsHook4, + writeText, + crateOverrideFn ? x: x, }: let extraCrateOverrides = { @@ -84,7 +77,7 @@ let # kinda silly though, since we patch out the actual cargo (rustc) invocations. 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) [ diff --git a/pkgs/additional/fractal-nixified/default.nix b/pkgs/additional/fractal-nixified/default.nix index b1fdc1d9c..d8f393cc4 100644 --- a/pkgs/additional/fractal-nixified/default.nix +++ b/pkgs/additional/fractal-nixified/default.nix @@ -9,35 +9,33 @@ # - re-run that crate2nix step # - update `src` rev to match the local checkout! -{ pkgs -, lib -, stdenv -, appstream-glib -, buildPackages -, cargo -, defaultCrateOverrides -, desktop-file-utils -, fetchFromGitHub -, gdk-pixbuf -, glib -, gst_all_1 -, gtk4 -, gtksourceview5 -, libadwaita -, libshumate -, meson -, ninja -, openssl -, pipewire -, pkg-config -, rust -, rustPlatform -, sqlite -, wrapGAppsHook4 -, writeText -, xdg-desktop-portal -, optimize ? true -, crateOverrideFn ? x: x +{ + appstream-glib, + buildPackages, + defaultCrateOverrides, + desktop-file-utils, + gdk-pixbuf, + glib, + gst_all_1, + gtk4, + gtksourceview5, + lib, + libadwaita, + libshumate, + meson, + ninja, + openssl, + pipewire, + pkg-config, + pkgs, + rustPlatform, + sqlite, + stdenv, + wrapGAppsHook4, + writeText, + xdg-desktop-portal, + optimize ? true, + crateOverrideFn ? x: x, }: let mkConfigured = { optimize }: let @@ -94,7 +92,7 @@ let # kinda silly though, since we patch out the actual cargo (rustc) invocations. 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) [ diff --git a/pkgs/additional/newsflash-nixified/default.nix b/pkgs/additional/newsflash-nixified/default.nix index 4ab8fa764..0b4a22b25 100644 --- a/pkgs/additional/newsflash-nixified/default.nix +++ b/pkgs/additional/newsflash-nixified/default.nix @@ -4,34 +4,22 @@ # # the generated Cargo.nix points to an impure source (~/ref/...), but that's resolved by overriding `src` below. { - lib, appstream-glib, - clapper, blueprint-compiler, + clapper, defaultCrateOverrides, desktop-file-utils, fetchFromGitLab, - gdk-pixbuf, - glib, - glib-networking, gst_all_1, - gtk4, + lib, libadwaita, - librsvg, libxml2, meson, ninja, - openssl, pkg-config, pkgs, - rust, - sqlite, - stdenv, webkitgtk_6_0, wrapGAppsHook4, - writeText, - xdg-utils, - crateOverrideFn ? x: x, }: let extraCrateOverrides = { @@ -89,7 +77,7 @@ let # # kinda silly though, since we patch out the actual cargo (rustc) invocations. # 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) [