oxalica / nil

NIx Language server, an incremental analysis assistant for writing in Nix.
Apache License 2.0
1.32k stars 39 forks source link

add RUST_SRC_PATH to devshell #91

Closed tennox closed 1 year ago

tennox commented 1 year ago

My rust-analyzer in vscode did not work without it.

Took it from here: https://github.com/NixOS/nixos-search/blob/main/flake.nix#L102

oxalica commented 1 year ago

We don't have rust-analyzer in devShell at the first place. I guess it's your rust-analyzer installation is broken and it is also broken in any other projects besides this.

in vscode

I guess you used the auto-downloaded rust-analyzer instead of the one packaged in nixpkgs. Please use the packaged one or add that envvar in your user/system environment, not just this particular project.

tennox commented 1 year ago

You're right - thanks for the hint :)

{ pkgs, ... }: {
  programs.vscode.userSettings = {
    rust-analyzer = { server.path = "${pkgs.rust-analyzer}/bin/rust-analyzer"; };
  };
}