I just initialized a rust project of mine using fh init. The whole thing generates a very nice looking flake, when prompted about rust-analyzer I confirmed it being added to the environment. However when trying to use some actix_web macros (project direnv-loaded into my editor), rust-analyzer is giving some compiler errors due to it not finding a sysroot.
rust-analyzer failed to load workspace: Failed to find sysroot [...]
Turns out it's a somewhat common issue, and you have to enable the rust-src extension when selecting a rustToolchain from oxalica/rust-overlay. The following changes to the fh-generated flake fixed the issue for me:
I believe most people will be enabling rust-analyzer for using it on their IDEs, and expect everything to be ready for working on their rust code.
My question is, would it be desirable to also add env.RUST_SRC_PATH (and enable rust-src) extension when people confirm to enable rust-analyzer ? If so, I'd gladly help with a PR for the rust handler.
I just initialized a rust project of mine using
fh init
. The whole thing generates a very nice looking flake, when prompted aboutrust-analyzer
I confirmed it being added to the environment. However when trying to use some actix_web macros (project direnv-loaded into my editor), rust-analyzer is giving some compiler errors due to it not finding a sysroot.Turns out it's a somewhat common issue, and you have to enable the
rust-src
extension when selecting a rustToolchain fromoxalica/rust-overlay
. The following changes to the fh-generated flake fixed the issue for me:I believe most people will be enabling
rust-analyzer
for using it on their IDEs, and expect everything to be ready for working on their rust code.My question is, would it be desirable to also add
env.RUST_SRC_PATH
(and enablerust-src
) extension when people confirm to enable rust-analyzer ? If so, I'd gladly help with a PR for the rust handler.