Skip to content

rust-analyzer errors out on Nix #1625

@Rua

Description

@Rua

Since a few weeks, when running rust-analyzer via vscodium on NixOS, it errors out like this:

[ERROR rust_analyzer::lsp_utils] rust-analyzer failed to load workspace: Failed to read Cargo metadata for Rust sources: Failed to run "cargo" "metadata" "--format-version" "1" "--manifest-path" "/nix/store/3fcjw8dm19ihsxj77ip2w4pnipcv75x9-rust-nightly-with-components-2022-08-08/lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.toml" "--filter-platform" "x86_64-unknown-linux-gnu": cargo metadata exited with an error: Updating crates.io index
error: failed to write /nix/store/3fcjw8dm19ihsxj77ip2w4pnipcv75x9-rust-nightly-with-components-2022-08-08/lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.lock

Caused by:
failed to open: /nix/store/3fcjw8dm19ihsxj77ip2w4pnipcv75x9-rust-nightly-with-components-2022-08-08/lib/rustlib/rustc-src/rust/compiler/rustc/Cargo.lock

Caused by:
Read-only file system (os error 30)

For some reason, it's trying to write to a Cargo.lock file in the Nix store, which is of course not possible.

@cydparser do you also get this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions