diff --git a/common/home/neovim/langs/default.nix b/common/home/neovim/langs/default.nix index c55a830..166a023 100644 --- a/common/home/neovim/langs/default.nix +++ b/common/home/neovim/langs/default.nix @@ -17,6 +17,7 @@ in { ./markdown.nix ./nix.nix ./python.nix + ./rust.nix ./web.nix ]; diff --git a/common/home/neovim/langs/rust.nix b/common/home/neovim/langs/rust.nix new file mode 100644 index 0000000..e01d18b --- /dev/null +++ b/common/home/neovim/langs/rust.nix @@ -0,0 +1,36 @@ +{ + config, + pkgs, + lib, + ... +}: let + inherit (config.vars) neovimIde; +in + lib.mkIf neovimIde { + programs = { + neovim = { + extraPackages = with pkgs; [ + cargo + rustc + rust-analyzer + rustfmt + ]; + + extraLuaConfig = + /* + lua + */ + '' + vim.api.nvim_create_autocmd('FileType', { + pattern = { 'rust' }, + command = 'setlocal ts=4 sw=4 sts=0 expandtab', + }); + + local lsp = require('lspconfig'); + local coq = require('coq'); + + lsp.rust_analyzer.setup(coq.lsp_ensure_capabilities({})); + ''; + }; + }; + }