treewide: prepare Rust packages for structuredAttrs by putting RUSTFLAGS in env (#475545)

This commit is contained in:
Wolfgang Walther
2026-01-08 08:47:48 +00:00
committed by GitHub
28 changed files with 95 additions and 74 deletions
@@ -44,14 +44,15 @@ rustPlatform.buildRustPackage rec {
# https://github.com/cloud-hypervisor/rust-hypervisor-firmware/issues/249
auditable = false;
RUSTC_BOOTSTRAP = 1;
env = {
RUSTC_BOOTSTRAP = 1;
RUSTFLAGS = "-C linker=lld -C linker-flavor=ld.lld";
};
nativeBuildInputs = [
lld
];
RUSTFLAGS = "-C linker=lld -C linker-flavor=ld.lld";
# Tests don't work for `no_std`. See https://os.phil-opp.com/testing/
doCheck = false;
+10 -9
View File
@@ -78,18 +78,19 @@ rustPlatform.buildRustPackage rec {
"-lpng"
"-lssl"
];
RUSTFLAGS = toString (
map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-lxkbcommon"
"-Wl,--pop-state"
]
);
};
RUSTFLAGS = map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-lxkbcommon"
"-Wl,--pop-state"
];
cargoBuildFlags = [
"--exclude alvr_xtask"
"--exclude=alvr_xtask"
"--workspace"
];
+12 -8
View File
@@ -77,14 +77,18 @@ rustPlatform.buildRustPackage rec {
wayland
];
# force linking to all the dlopen()ed dependencies
RUSTFLAGS = map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lfontconfig"
"-lwayland-client"
"-Wl,--pop-state"
];
env = {
# force linking to all the dlopen()ed dependencies
RUSTFLAGS = toString (
map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lfontconfig"
"-lwayland-client"
"-Wl,--pop-state"
]
);
};
# upstream has minimal tests, so don't rebuild twice
doCheck = false;
+1 -1
View File
@@ -21,7 +21,7 @@ rustPlatform.buildRustPackage rec {
rustPlatform.bindgenHook
];
RUSTFLAGS = "--cfg tracing_unstable";
env.RUSTFLAGS = "--cfg tracing_unstable";
meta = {
description = "User-friendly, lightweight TUI for disk imaging";
+1 -1
View File
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-8YftVt72JpmxWB/WvOPpduE0/QgYvQhSuFRmsFth2iU=";
sourceRoot = "${src.name}/rust";
buildAndTestSubdir = "gateway";
RUSTFLAGS = "--cfg system_certs";
env.RUSTFLAGS = "--cfg system_certs";
# Required to remove profiling arguments which conflict with this builder
postPatch = ''
@@ -82,7 +82,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-TDP1Z4MeQaSER8MGnCEQfIhRsakaSCeJ7boUMBYkkI0=";
sourceRoot = "${src.name}/rust";
buildAndTestSubdir = "gui-client";
RUSTFLAGS = "--cfg system_certs";
env.RUSTFLAGS = "--cfg system_certs";
nativeBuildInputs = [
cargo-tauri.hook
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-J2IqqFBuoTkbO0nMJbY680G2HTAtC1To/nMra2PCopY=";
sourceRoot = "${src.name}/rust";
buildAndTestSubdir = "headless-client";
RUSTFLAGS = "--cfg system_certs";
env.RUSTFLAGS = "--cfg system_certs";
# Required to remove profiling arguments which conflict with this builder
postPatch = ''
+1 -1
View File
@@ -16,7 +16,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-uqy4GgYaSX2kM4a37093lHmhvOtNUhkEs6/ZS1bjuYo=";
sourceRoot = "${src.name}/rust";
buildAndTestSubdir = "relay";
RUSTFLAGS = "--cfg system_certs";
env.RUSTFLAGS = "--cfg system_certs";
# Required to remove profiling arguments which conflict with this builder
postPatch = ''
+1 -1
View File
@@ -38,7 +38,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-rE7SErOhl2fcmvLairq+mvdnbDIk1aPo3eYqwRx5kkA=";
# See https://github.com/mikedilger/gossip/blob/0.9/README.md.
RUSTFLAGS = "--cfg tokio_unstable";
env.RUSTFLAGS = "--cfg tokio_unstable";
# Some users might want to add "rustls-tls(-native)" for Rust TLS instead of OpenSSL.
buildFeatures = [
+4 -2
View File
@@ -34,8 +34,10 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-UcS2gAoa2fzPu6hh8I5sXSHHbAmzsecT44Ju2CVsK0Q=";
RUSTC_BOOTSTRAP = 1;
RUSTFLAGS = "--cfg=web_sys_unstable_apis";
env = {
RUSTC_BOOTSTRAP = 1;
RUSTFLAGS = "--cfg=web_sys_unstable_apis";
};
nativeBuildInputs = [
wasm-bindgen-cli_0_2_100
+5 -3
View File
@@ -128,9 +128,11 @@ stdenv.mkDerivation (finalAttrs: {
cargo
];
RUST_BACKTRACE = 1;
# https://github.com/Riey/kime/issues/688
RUSTFLAGS = "-Clink-args=-L./target/release";
env = {
RUST_BACKTRACE = 1;
# https://github.com/Riey/kime/issues/688
RUSTFLAGS = "-Clink-args=-L./target/release";
};
meta = {
homepage = "https://github.com/Riey/kime";
+1 -1
View File
@@ -53,7 +53,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
];
# we do this here so that the binary is usable during integration tests
RUSTFLAGS = lib.optionalString stdenv.targetPlatform.isElf (
env.RUSTFLAGS = lib.optionalString stdenv.targetPlatform.isElf (
lib.concatStringsSep " " [
"-C link-arg=-Wl,-rpath,${
lib.makeLibraryPath [
+9 -7
View File
@@ -36,13 +36,15 @@ rustPlatform.buildRustPackage (finalAttrs: {
libglvnd
];
RUSTFLAGS = map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-lxkbcommon"
"-Wl,--pop-state"
];
env.RUSTFLAGS = toString (
map (a: "-C link-arg=${a}") [
"-Wl,--push-state,--no-as-needed"
"-lEGL"
"-lwayland-client"
"-lxkbcommon"
"-Wl,--pop-state"
]
);
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
+1 -1
View File
@@ -23,7 +23,7 @@ rustPlatform.buildRustPackage rec {
# require running database
doCheck = false;
RUSTFLAGS = [
env.RUSTFLAGS = toString [
# MEMO: mitra use ammonia crate with unstable rustc flag
"--cfg=ammonia_unstable"
];
@@ -124,13 +124,14 @@ rustPlatform.buildRustPackage {
"--bin=pxar"
];
RUSTFLAGS = [ "-L.dep-stubs" ];
env = {
RUSTFLAGS = toString [ "-L.dep-stubs" ];
# pbs-buildcfg requires this set, would be the git commit id
REPOID = "";
};
doCheck = false;
# pbs-buildcfg requires this set, would be the git commit id
REPOID = "";
nativeBuildInputs = [
pkgconf
rustPlatform.bindgenHook
+1 -1
View File
@@ -18,7 +18,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-AcH5V5hapVQgGrwWAEN6Xpj00RRNqZiCSn+/onpmd50=";
RUSTFLAGS = "--cfg tokio_unstable";
env.RUSTFLAGS = "--cfg tokio_unstable";
checkFlags = [
# these tests set setuid permissions on a test file (3oXXX) which doesn't work in a sandbox
+7 -6
View File
@@ -100,13 +100,14 @@ rustPlatform.buildRustPackage (finalAttrs: {
checkFlags = [
# Error: deadline has elapsed
"--skip replicated_loglet"
"--skip"
"replicated_loglet"
# TIMEOUT [ 180.006s]
"--skip fast_forward_over_trim_gap"
# TIMEOUT (could be related to https://github.com/restatedev/restate/issues/3043)
"--skip restatectl_smoke_test"
"--skip"
"fast_forward_over_trim_gap"
# TIMEOUT (could be related to https://github.com/resytatedev/restate/issues/3043)
"--skip"
"restatectl_smoke_test"
];
__darwinAllowLocalNetworking = true;
+1 -1
View File
@@ -35,7 +35,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-v+lLCI2ti/xL8hcGkm/xDDN9qk0G9MgtijE8xYnhC68=";
# override debug=true set in Cargo.toml upstream
RUSTFLAGS = "-C debuginfo=none";
env.RUSTFLAGS = "-C debuginfo=none";
nativeBuildInputs = [
makeWrapper
+5 -3
View File
@@ -55,10 +55,12 @@ rustPlatform.buildRustPackage rec {
zstd
];
env.ZSTD_SYS_USE_PKG_CONFIG = true;
env = {
ZSTD_SYS_USE_PKG_CONFIG = true;
# error[E0425]: cannot find function `consume_budget` in module `tokio::task`
env.RUSTFLAGS = "--cfg tokio_unstable";
# error[E0425]: cannot find function `consume_budget` in module `tokio::task`
RUSTFLAGS = "--cfg tokio_unstable";
};
# requires a complex setup with podman for the end-to-end tests
doCheck = false;
+7 -5
View File
@@ -26,13 +26,15 @@ rustPlatform.buildRustPackage (finalAttrs: {
rm .cargo/config.toml
'';
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
env = {
PROTOC = "${protobuf}/bin/protoc";
PROTOC_INCLUDE = "${protobuf}/include";
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
RUSTFLAGS = "--cfg surrealdb_unstable";
RUSTFLAGS = "--cfg surrealdb_unstable";
};
nativeBuildInputs = [
pkg-config
+4 -4
View File
@@ -28,13 +28,13 @@ rustPlatform.buildRustPackage rec {
];
# uses currently unstable tokio features
RUSTFLAGS = "--cfg tokio_unstable";
env.RUSTFLAGS = "--cfg tokio_unstable";
checkFlags = [
# tests depend upon git repository at test execution time
"--skip bootstrap"
"--skip config::tests::args_example_changed"
"--skip config::tests::toml_example_changed"
"--skip=bootstrap"
"--skip=config::tests::args_example_changed"
"--skip=config::tests::toml_example_changed"
];
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
+4 -2
View File
@@ -21,8 +21,10 @@ rustPlatform.buildRustPackage {
nativeBuildInputs = [ rustPlatform.bindgenHook ];
buildInputs = [ ipset ];
env.RUSTC_BOOTSTRAP = true;
env.RUSTFLAGS = "--cfg tokio_unstable";
env = {
RUSTC_BOOTSTRAP = true;
RUSTFLAGS = "--cfg tokio_unstable";
};
meta = {
homepage = "https://github.com/lazytiger/trojan-rs";
+1 -1
View File
@@ -33,7 +33,7 @@ rustPlatform.buildRustPackage rec {
"--workspace"
];
RUSTFLAGS = "--cfg tokio_unstable";
env.RUSTFLAGS = "--cfg tokio_unstable";
doCheck = false;
+1 -1
View File
@@ -52,7 +52,7 @@ rustPlatform.buildRustPackage (
(replaceVars ./hardcode-version.patch { inherit (finalAttrs) version; })
];
RUSTFLAGS = "--cfg tokio_unstable";
env.RUSTFLAGS = "--cfg tokio_unstable";
buildFeatures = [
"postgres"
+1 -1
View File
@@ -30,7 +30,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
libpulseaudio
];
RUSTFLAGS = [
env.RUSTFLAGS = toString [
"--cfg tokio_unstable"
"--cfg tokio_uring"
];
+1 -1
View File
@@ -30,7 +30,7 @@ rustPlatform.buildRustPackage {
cargoHash = "sha256-krrVgdoCcW3voSiQAoWsG+rPf1HYKbuGhplhn21as2c=";
RUSTFLAGS = "-C target-feature=+avx2"; # only works on x86 systems supporting AVX2
env.RUSTFLAGS = "-C target-feature=+avx2"; # only works on x86 systems supporting AVX2
preFixup = ''
cp wprs "$out/bin/wprs"
+1 -2
View File
@@ -208,10 +208,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
# Used by `zed --version`
RELEASE_VERSION = finalAttrs.version;
LK_CUSTOM_WEBRTC = livekit-libwebrtc;
RUSTFLAGS = lib.optionalString withGLES "--cfg gles";
};
RUSTFLAGS = lib.optionalString withGLES "--cfg gles";
preBuild = ''
bash script/generate-licenses
'';
@@ -26,8 +26,10 @@ buildPythonPackage {
patch -p1 < tmp.diff
'';
RUSTFLAGS = "-C target-feature=";
RUSTC_BOOTSTRAP = 1;
env = {
RUSTFLAGS = "-C target-feature=";
RUSTC_BOOTSTRAP = 1;
};
buildAndTestSubdir = "mitmproxy-linux";