-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
How to use the overlay for Rust Language Server? #20
Comments
I ended up switching to a different language server, and had to specify a manual list of extensions to include rust-analyzer: srid/rust-nix-template@b767bad |
There are already |
I prefer to install VSCode extensions outside of NixOS (I use Settings Sync). As for |
@oxalica , hi there, I am also having difficult to use language server with neovim, just installed rust-analyzer and coc-rust-analyzer.... it complains that the rust-src is not installed.
|
|
Thanks @oxalica , I added, and the rls started, but complained about the rust-src. I am trying to figure out how to add the rust-src in my home-manager. Anyway I need to use your overlay to be updated to rustc 1.57, and I am avoiding to use rustup. I saw in the README the possibility below, but need help to understand how to add to the home-manager...
|
I figured this out but I'm not sure if I'm doing this right. I noticed mkShell {
buildInputs = [
(rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer-preview" ];
})
];
} But that gave me this error:
So I went to the mentioned URL and noticed that the nightlies definitely do have rust-analyzer-preview so I changed my rust-bin to All that said and done, I tried simply adding I am using Nix Environment Selector to make sure the rust-analyzer plugin picks up these binaries. |
@m1cr0man thanks for the follow-up, in fact, I feel that I lack enough nix knowledge to understand how to have the overlay working with neovim or vscode, but I just gave another step, the rust-src is declared, but still not on the right path, so I am still receiving :
My config belowAll inside the ./config/nixpkgs overlay.nix
home.nix
env/dev.nix
|
@m1cr0man seems I just found a fix that should also work for you. I am getting the rust-analyzer from outside (unstable nix pkgs). The code completion is working, but nvim still shows RLS starting. The coc.nvim also still complains "Rustup not available", but the stuff seems to be working.
|
@henry-hz Thanks for sharing that! I forgot to follow up post-christmas until now 😅 Your final solution is very similar to what I ended up using too. I managed to create a nix-shell compatible file for use in VS Code, and the rust-analyzer plugin does not seem to be stuck in a loading loop for me fortunately. I also learned much more about flakes over christmas, and thus came up with this quite elegant way to download everything required (if you have the freedom to use nix develop + a flake.nix, do that instead). let
rustVersion = "1.57.0";
defaultPkgs = import (builtins.getFlake "nixpkgs") {
overlays = [ (builtins.getFlake "github:oxalica/rust-overlay").overlay ];
};
in { pkgs ? defaultPkgs }:
with pkgs;
mkShell {
buildInputs = [
(rust-bin.stable."${rustVersion}".default.override {
extensions = [ "rust-src" "rustfmt" ];
})
rust-analyzer
];
} Note I'm using |
@m1cr0man indeed very elegant and useful ! thanks for sharing :) |
I use VSCode, and it fails to start the Rust Language Server for my project using this overlay. From IDE logs,
What's the idiomatic way to configure this overlay in my flake.nix[1] so that when VSCode is launched in
nix develop
to the point that the Rust IDE extension works?Thanks!
[1] You can find mine here: https://github.com/srid/bouncy/blob/afec3ca7c8771c035adfcbf32031f31f1bf568a4/flake.nix
The text was updated successfully, but these errors were encountered: