neovim, add rust language support

This commit is contained in:
Julia Lange 2024-04-23 23:17:10 -07:00
parent b16fb47719
commit 1b6627bcbe
4 changed files with 16 additions and 5 deletions

View file

@ -4,8 +4,9 @@
options.neovim = { options.neovim = {
enable = lib.mkEnableOption "Enables neovim"; enable = lib.mkEnableOption "Enables neovim";
languages = { languages = {
nix.enable = lib.mkEnableOption "Enables nix support";
c.enable = lib.mkEnableOption "Enables c support"; c.enable = lib.mkEnableOption "Enables c support";
nix.enable = lib.mkEnableOption "Enables nix support";
rust.enable = lib.mkEnableOption "Enables rust support";
}; };
plugins = { plugins = {
comments.enable = lib.mkEnableOption "Enables nvim-comment"; comments.enable = lib.mkEnableOption "Enables nvim-comment";
@ -46,8 +47,9 @@
''; '';
extraPackages = with pkgs; [ extraPackages = with pkgs; [
(lib.mkIf config.neovim.languages.nix.enable nil)
(lib.mkIf config.neovim.languages.c.enable libclang) (lib.mkIf config.neovim.languages.c.enable libclang)
(lib.mkIf config.neovim.languages.nix.enable nil)
(lib.mkIf config.neovim.languages.rust.enable rust-analyzer)
]; ];
# Additional packages are added through imports # Additional packages are added through imports
@ -91,6 +93,10 @@
vim-nix vim-nix
]); ]);
rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [
rustaceanvim
]);
wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [ wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [
{ {
plugin = vimwiki; plugin = vimwiki;
@ -107,7 +113,8 @@
''; '';
} }
]); ]);
in comments ++ fugitive ++ luasnip-pkg ++ lualine ++ nix-pkg ++ wiki; in comments ++ fugitive ++ luasnip-pkg ++ lualine ++
nix-pkg ++ rust-pkg ++ wiki;
}; };
}; };
} }

View file

@ -39,6 +39,8 @@
require('lspconfig').nil_ls.setup {} require('lspconfig').nil_ls.setup {}
'' + lib.strings.optionalString cfgl.c.enable '' '' + lib.strings.optionalString cfgl.c.enable ''
require('lspconfig').clangd.setup {} require('lspconfig').clangd.setup {}
'' + lib.strings.optionalString cfgl.rust.enable ''
require('lspconfig').rustaceanvim.setup {}
''; '';
in with pkgs.vimPlugins; [ in with pkgs.vimPlugins; [
{ {

View file

@ -21,8 +21,9 @@ in {
# I've tried many things, and can't get treesitter plugins changing # I've tried many things, and can't get treesitter plugins changing
# dynamically. For not just have them always loaded regardless of config # dynamically. For not just have them always loaded regardless of config
treeplugs = p: [ treeplugs = p: [
p.tree-sitter-nix
p.tree-sitter-c p.tree-sitter-c
p.tree-sitter-nix
p.tree-sitter-rust
]; ];
in with pkgs.vimPlugins; [ in with pkgs.vimPlugins; [
{ {

View file

@ -29,8 +29,9 @@
neovim.enable = true; neovim.enable = true;
neovim.languages = { neovim.languages = {
nix.enable = true;
c.enable = true; c.enable = true;
nix.enable = true;
rust.enable = true;
}; };
neovim.plugins = { neovim.plugins = {
comments.enable = true; comments.enable = true;