refactor: remove uses of deprecated "rust.toRustTarget"

This commit is contained in:
2024-09-11 01:25:15 +00:00
parent 33aaf8c458
commit 884435fe21
4 changed files with 67 additions and 97 deletions

View File

@@ -312,9 +312,9 @@ in with final; {
# cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; # cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
# ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; # ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
# cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; # cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
# rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform; # rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget;
# rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; # rustTargetPlatform = stdenv.hostPlatform.rust.rustcTarget;
# rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform; # rustTargetPlatformSpec = stdenv.hostPlatform.rust.rustcTargetSpec;
# in { # in {
# # taken from <pkgs/build-support/rust/hooks/default.nix> # # taken from <pkgs/build-support/rust/hooks/default.nix>
# # fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option -m64" # # 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: lemoa = (prev.lemoa.override { cargo = crossCargo; }).overrideAttrs (upstream: {
let preBuild = ''
rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; mkdir -p target/release
in { ln -s ../${stdenv.hostPlatform.rust.rustcTarget}/release/lemoa target/release/lemoa
preBuild = '' '';
mkdir -p target/release });
ln -s ../${rustTargetPlatform}/release/lemoa target/release/lemoa
'';
}
);
# libgweather = prev.libgweather.overrideAttrs (upstream: { # libgweather = prev.libgweather.overrideAttrs (upstream: {
# nativeBuildInputs = (lib.remove gobject-introspection upstream.nativeBuildInputs) ++ [ # nativeBuildInputs = (lib.remove gobject-introspection upstream.nativeBuildInputs) ++ [
@@ -784,7 +780,7 @@ in with final; {
postPatch = (upstream.postPatch or "") + '' postPatch = (upstream.postPatch or "") + ''
substituteInPlace src/meson.build --replace-fail \ substituteInPlace src/meson.build --replace-fail \
"'src' / rust_target" \ "'src' / rust_target" \
"'src' / '${rust.toRustTarget stdenv.hostPlatform}' / rust_target" "'src' / '${stdenv.hostPlatform.rust.rustcTarget}' / rust_target"
rm build.rs rm build.rs
@@ -800,14 +796,12 @@ in with final; {
''; '';
env = let env = let
inherit buildPackages stdenv rust;
ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; ccForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc";
cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; cxxForBuild = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; ccForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"; cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
rustBuildPlatform = rust.toRustTarget stdenv.buildPlatform; rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget;
rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform; rustTargetPlatform = stdenv.hostPlatform.rust.rustcTarget;
rustTargetPlatformSpec = rust.toRustTargetSpec stdenv.hostPlatform;
in (upstream.env or {}) // { in (upstream.env or {}) // {
# taken from <pkgs/build-support/rust/hooks/default.nix> # taken from <pkgs/build-support/rust/hooks/default.nix>
# fixes "cargo:warning=aarch64-unknown-linux-gnu-gcc: error: unrecognized command-line option -m64" # 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 # 2024/09/01: upstreaming is unblocked
pwvucontrol = (prev.pwvucontrol.override { pwvucontrol = (prev.pwvucontrol.override {
cargo = crossCargo; cargo = crossCargo;
}).overrideAttrs (upstream: }).overrideAttrs (upstream: {
let
rustTargetPlatform = rust.toRustTarget stdenv.hostPlatform;
in {
postPatch = (upstream.postPatch or "") + '' postPatch = (upstream.postPatch or "") + ''
substituteInPlace src/meson.build --replace-fail \ substituteInPlace src/meson.build --replace-fail \
"'src' / rust_target" \ "'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 # # ERROR: 'rust' compiler binary not defined in cross or native file
# crossFile = writeText "cross-file.conf" '' # crossFile = writeText "cross-file.conf" ''
# [binaries] # [binaries]
# rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ] # rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
# ''; # '';
# in # in
# # upstream.mesonFlags or [] ++ # # upstream.mesonFlags or [] ++

View File

@@ -12,33 +12,26 @@
# - link to signald JMP.chat: NO (http 405) # - link to signald JMP.chat: NO (http 405)
# - primary device via JMP.chat: NO (http 422) # - primary device via JMP.chat: NO (http 422)
# - link to iOS tel: NO (http 405) # - link to iOS tel: NO (http 405)
{ lib {
, appstream-glib appstream-glib,
, blueprint-compiler blueprint-compiler,
, buildPackages defaultCrateOverrides,
, defaultCrateOverrides desktop-file-utils,
, desktop-file-utils fetchFromGitLab,
, fetchFromGitLab gst_all_1,
, flare-signal gtk4,
, gdk-pixbuf gtksourceview5,
, glib lib,
, gobject-introspection libadwaita,
, gst_all_1 meson,
, gtk4 ninja,
, gtksourceview5 pkg-config,
, libadwaita pkgs,
, libsecret protobuf,
, libspelling stdenv,
, meson wrapGAppsHook4,
, ninja writeText,
, pkg-config crateOverrideFn ? x: x,
, pkgs
, protobuf
, rust
, stdenv
, wrapGAppsHook4
, writeText
, crateOverrideFn ? x: x
}: }:
let let
extraCrateOverrides = { extraCrateOverrides = {
@@ -84,7 +77,7 @@ let
# kinda silly though, since we patch out the actual cargo (rustc) invocations. # kinda silly though, since we patch out the actual cargo (rustc) invocations.
crossFile = writeText "cross-file.conf" '' crossFile = writeText "cross-file.conf" ''
[binaries] [binaries]
rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ] rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
''; '';
in in
lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [

View File

@@ -9,35 +9,33 @@
# - re-run that crate2nix step # - re-run that crate2nix step
# - update `src` rev to match the local checkout! # - update `src` rev to match the local checkout!
{ pkgs {
, lib appstream-glib,
, stdenv buildPackages,
, appstream-glib defaultCrateOverrides,
, buildPackages desktop-file-utils,
, cargo gdk-pixbuf,
, defaultCrateOverrides glib,
, desktop-file-utils gst_all_1,
, fetchFromGitHub gtk4,
, gdk-pixbuf gtksourceview5,
, glib lib,
, gst_all_1 libadwaita,
, gtk4 libshumate,
, gtksourceview5 meson,
, libadwaita ninja,
, libshumate openssl,
, meson pipewire,
, ninja pkg-config,
, openssl pkgs,
, pipewire rustPlatform,
, pkg-config sqlite,
, rust stdenv,
, rustPlatform wrapGAppsHook4,
, sqlite writeText,
, wrapGAppsHook4 xdg-desktop-portal,
, writeText optimize ? true,
, xdg-desktop-portal crateOverrideFn ? x: x,
, optimize ? true
, crateOverrideFn ? x: x
}: }:
let mkConfigured = { optimize }: let mkConfigured = { optimize }:
let let
@@ -94,7 +92,7 @@ let
# kinda silly though, since we patch out the actual cargo (rustc) invocations. # kinda silly though, since we patch out the actual cargo (rustc) invocations.
crossFile = writeText "cross-file.conf" '' crossFile = writeText "cross-file.conf" ''
[binaries] [binaries]
rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ] rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
''; '';
in in
lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [

View File

@@ -4,34 +4,22 @@
# #
# the generated Cargo.nix points to an impure source (~/ref/...), but that's resolved by overriding `src` below. # the generated Cargo.nix points to an impure source (~/ref/...), but that's resolved by overriding `src` below.
{ {
lib,
appstream-glib, appstream-glib,
clapper,
blueprint-compiler, blueprint-compiler,
clapper,
defaultCrateOverrides, defaultCrateOverrides,
desktop-file-utils, desktop-file-utils,
fetchFromGitLab, fetchFromGitLab,
gdk-pixbuf,
glib,
glib-networking,
gst_all_1, gst_all_1,
gtk4, lib,
libadwaita, libadwaita,
librsvg,
libxml2, libxml2,
meson, meson,
ninja, ninja,
openssl,
pkg-config, pkg-config,
pkgs, pkgs,
rust,
sqlite,
stdenv,
webkitgtk_6_0, webkitgtk_6_0,
wrapGAppsHook4, wrapGAppsHook4,
writeText,
xdg-utils,
crateOverrideFn ? x: x,
}: }:
let let
extraCrateOverrides = { extraCrateOverrides = {
@@ -89,7 +77,7 @@ let
# # kinda silly though, since we patch out the actual cargo (rustc) invocations. # # kinda silly though, since we patch out the actual cargo (rustc) invocations.
# crossFile = writeText "cross-file.conf" '' # crossFile = writeText "cross-file.conf" ''
# [binaries] # [binaries]
# rust = [ 'rustc', '--target', '${rust.toRustTargetSpec stdenv.hostPlatform}' ] # rust = [ 'rustc', '--target', '${stdenv.hostPlatform.rust.rustcTargetSpec}' ]
# ''; # '';
# in # in
# lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ # lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [