-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in flake mkShell default RUSTFLAGS to an empty string if unset #10880
in flake mkShell default RUSTFLAGS to an empty string if unset #10880
Conversation
What error does this fix? I run nixos without a global Rust installation and no |
Yeah rust installations don't even set RUSTFLAGS. An empty environment variable just expands to an empty string so it should work as is |
Maybe it's a direnv thing, but
whereas with |
Yeah |
I'm also using direnv but I don't see that error |
hm weird. Might be messed up on my end somehow then
|
Figured out what causes the error. I have in
and it is this
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little skeptical that set -u
will ever become the default in direnv because of how much I suspect it would break (of user scripts). Explicitly defaulting the variable seems fine to me though. I just have a small change in mind
flake.nix
Outdated
then ''''${RUSTFLAGS:-""} -C link-arg=-fuse-ld=lld -C target-cpu=native -Clink-arg=-Wl,--no-rosegment'' | ||
else "$RUSTFLAGS"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The else
branch here will also need the explicit defaulting. Instead we can change the line below for exporting the custom rust flags to
export RUSTFLAGS="''${RUSTFLAGS:-""} ${rustFlagsEnv}"
and remove the $RUSTFLAGS
from this variable altogether
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a cleaner approach indeed. Updated.
faaf21b
to
ec8dc18
Compare
This allows activation of the devshell on systems that don't have a system wide Rust installation.