nixvim icon indicating copy to clipboard operation
nixvim copied to clipboard

[BUG] Rustacean no longer works - rustanalyizer can't find dynamically linked cargo

Open clotodex opened this issue 1 year ago • 3 comments

Field Description
Plugin rustacean
Nixpkgs unstable
Home Manager unstable

  • [x] I have read the FAQ and my bug is not listed there.

Description

Since a month or so Rustacean does not start the rust-analyzer anymore. Looking into the logs this is a linking issue.

Caused by:
    0: Failed to query rust toolchain version at /home/<user>/projects/<project>, is your toolchain setup correctly?
    1: cd "<path>" && RUSTUP_TOOLCHAIN="/nix/store/3dpmxz017c7w9rjqicymjk4az220d78n-rust-mixed" "/home/<user>/.cargo/bin/cargo" "--version" failed, exit status: 127
       stderr:
       Could not start dynamically linked executable: /home/<user>/.cargo/bin/cargo
       NixOS cannot run dynamically linked executables intended for generic
       linux environments out of the box. For more information, see:
       https://nix.dev/permalink/stub-ld

While the error is obvious, I am curious why that started happening out of the blue? And since this makes rustacean not work out of the box anymore I am raising this issue. Anyone has a nicer workaround than force-linking a version of cargo?

Minimal, Reproducible Example (MRE)

Open any rust file with an installed rust-analyzer. (Tried NixOS, devenv and fenix)

programs.nixvim = {
      plugins = {
        rustaceanvim = {
        enable = true;
        settings = {
          server.default_settings.files.excludeDirs = [".direnv"];
          dap.autoloadConfigurations = true;
        };
      };
    }:
}

clotodex avatar Sep 05 '24 09:09 clotodex

I personally install cargo/rustc through nix using https://github.com/nix-community/fenix or https://github.com/oxalica/rust-overlay to avoid those kinds of issues

traxys avatar Sep 05 '24 13:09 traxys

I am using fenix as well. However it seems to be not limited to rust analyzer but all cargo linked commands.

clotodex avatar Sep 05 '24 19:09 clotodex

https://github.com/cachix/devenv/issues/1419 Investigating if this might be a devenv issue. I am now very sure this is not unique to nixvim - I just noticed it here first - so happy with closing. The issue is not yet resolved but I am trying to figure out if it is generally bricked in nixpkgs, a nixos issue or a devenv specific issue. I will update my findings in the linked issue.

clotodex avatar Sep 06 '24 07:09 clotodex

fixed - was a nix linking user error :D A binary was erroneously linked in my ~/.cargo/bin from before nix times

clotodex avatar Dec 26 '24 16:12 clotodex

fixed - was a nix linking user error :D A binary was erroneously linked in my ~/.cargo/bin from before nix times

Thank you for reporting your success ;)

GaetanLepage avatar Dec 26 '24 23:12 GaetanLepage