From a1cda3c19e510999362f533476dd87e21fc833d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asger=20Juul=20Brunsh=C3=B8j?= Date: Mon, 10 Jun 2024 17:08:39 +0200 Subject: [PATCH] in flake mkShell default RUSTFLAGS to an empty string if unset (#10880) --- flake.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index e113d94b..c230dc31 100644 --- a/flake.nix +++ b/flake.nix @@ -114,10 +114,7 @@ if pkgs.stdenv.isLinux then pkgs.stdenv else pkgs.clangStdenv; - rustFlagsEnv = - if stdenv.isLinux - then ''$RUSTFLAGS -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment'' - else "$RUSTFLAGS"; + rustFlagsEnv = pkgs.lib.optionalString stdenv.isLinux "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment"; rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; craneLibMSRV = (crane.mkLib pkgs).overrideToolchain rustToolchain; craneLibStable = (crane.mkLib pkgs).overrideToolchain pkgs.pkgsBuildHost.rust-bin.stable.latest.default; @@ -183,7 +180,7 @@ shellHook = '' export HELIX_RUNTIME="$PWD/runtime" export RUST_BACKTRACE="1" - export RUSTFLAGS="${rustFlagsEnv}" + export RUSTFLAGS="''${RUSTFLAGS:-""} ${rustFlagsEnv}" ''; }; })