Skip to content

Conversation

@JonBoyleCoding
Copy link
Contributor

I don't know if you're looking for contributions. I needed to have a working Rust setup so I made one in my repo - thought I'd submit the PR in case you do!

Really nice module by the way - simplifies my setup a lot!

@matadaniel
Copy link
Owner

Thank you for your contribution and your kind words! I don't use Rust currently, but this will help those who do.

++ (with pkgs.vimPlugins; [
crates-nvim
rustaceanvim
clangd_extensions-nvim
Copy link
Owner

@matadaniel matadaniel Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Genuinely curious as to why clangd-extensions is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give it a test without. When I made the PR I was having issues with my LazyVim being half stuck between versions and rustaceanvim wasn't working. I've figured out that issue now though.

@matadaniel
Copy link
Owner

Let's wait and see what happens with LazyVim/LazyVim#5537. I would appreciate it if you could go and check if rustaceanvim does detect codelldb.


config = mkIf cfg.extras.lang.rust.enable {
programs.neovim = {
extraPackages = [ pkgs.rust-analyzer ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR! I tested it out and would just note that it might be useful to be able to disable installation of rust-analyzer nix-community/nixvim#1135. Not that it's ideal, but, for example, if someone were using rustup, this could conflict.

Comment on lines 25 to 27
(pkgs.vimPlugins.nvim-treesitter.withPlugins (
plugins: builtins.attrValues { inherit (plugins) rust; }
))
Copy link
Contributor

@cameronraysmith cameronraysmith Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to define __darwinAllowLocalNetworking in order to work on Darwin.

Suggested change
(pkgs.vimPlugins.nvim-treesitter.withPlugins (
plugins: builtins.attrValues { inherit (plugins) rust; }
))
# NOTE: enabling rust treesitter on Darwin leads to
# error: The option `programs.neovim.plugins."[definition 2-entry 1]"
# .__darwinAllowLocalNetworking' does not exist.
(if pkgs.stdenv.isDarwin then
pkgs.vimUtils.buildVimPlugin {
inherit (nvim-treesitter.withPlugins (
plugins: with plugins; [ rust ron ]
)) pname version src meta;
__darwinAllowLocalNetworking = true;
}
else
nvim-treesitter.withPlugins (
plugins: with plugins; [ rust ron ]
)
)

It may also work if the attribute is just defined with an empty string value.
Note I also added ron since it's in https://github.com/LazyVim/LazyVim/blob/v14.14.0/lua/lazyvim/plugins/extras/lang/rust.lua#L39-L42 .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to adopt something like this, maybe postpone my alternate list construction from #6 (comment) since it's inconsistent with the rest of the repo.

@JonBoyleCoding JonBoyleCoding marked this pull request as draft March 26, 2025 15:23
@phucisstupid
Copy link
Contributor

any update on this

@JonBoyleCoding
Copy link
Contributor Author

I'm still waiting to see what happens with the PR that @matadaniel mentioned before finishing this PR -- unless they say otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants