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++";
# 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 <pkgs/build-support/rust/hooks/default.nix>
# # 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 <pkgs/build-support/rust/hooks/default.nix>
# 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 [] ++

View File

@@ -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) [

View File

@@ -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) [

View File

@@ -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) [