Unnamed repository; edit this file 'description' to name the repository.
flake: Split platform and common RUSTFLAGS in devShell
The `--no-rosegment` is not supported on macOS but the other flag configurations can be used on both macOS and Linux.
Michael Davis 12 months ago
parent 1955883 · commit b6e58c0
-rw-r--r--flake.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/flake.nix b/flake.nix
index b093ded5..0712b17e 100644
--- a/flake.nix
+++ b/flake.nix
@@ -57,7 +57,8 @@
# Devshell behavior is preserved.
devShells.default = let
- rustFlagsEnv = pkgs.lib.optionalString pkgs.stdenv.isLinux "-C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment --cfg tokio_unstable";
+ commonRustFlagsEnv = "-C link-arg=-fuse-ld=lld -C target-cpu=native --cfg tokio_unstable";
+ platformRustFlagsEnv = pkgs.lib.optionalString pkgs.stdenv.isLinux "-Clink-arg=-Wl,--no-rosegment";
in
pkgs.mkShell
{
@@ -73,7 +74,7 @@
++ (lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreFoundation);
shellHook = ''
export RUST_BACKTRACE="1"
- export RUSTFLAGS="''${RUSTFLAGS:-""} ${rustFlagsEnv}"
+ export RUSTFLAGS="''${RUSTFLAGS:-""} ${commonRustFlagsEnv} ${platformRustFlagsEnv}"
'';
};
})