From 13bbcd5a5feffa4a91f4e4068e68e9baf2f90223 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 12 May 2021 20:54:32 +0200 Subject: vim: better config with lua, with some dev config --- common/vim.nix | 206 ++++++++++++++++++++++-------------- dotfiles/vim-dev.lua | 61 +++++++++++ dotfiles/vim.lua | 223 +++++++++++++++++++++++++++++++++++++++ dotfiles/vimrc.vim | 139 ------------------------ flake.lock | 59 +++++++++-- flake.nix | 28 +++-- profiles/desktop.nix | 8 -- usecases/desktop/development.nix | 39 +++++++ 8 files changed, 513 insertions(+), 250 deletions(-) create mode 100644 dotfiles/vim-dev.lua create mode 100644 dotfiles/vim.lua delete mode 100644 dotfiles/vimrc.vim create mode 100644 usecases/desktop/development.nix diff --git a/common/vim.nix b/common/vim.nix index aa74a39..ec43738 100644 --- a/common/vim.nix +++ b/common/vim.nix @@ -2,81 +2,108 @@ inputs: { config, pkgs, lib, ... }: -let myNeovim = (pkgs.neovim.override { - configure = { - - inherit (config.vim) beforePlugins; - - customRC = with lib; - (concatStringsSep - "\n" - (mapAttrsToList - (variable: value: "let g:${variable} = ${value}") - config.vim.variables)) - + "\n" - + builtins.readFile ../dotfiles/vimrc.vim + config.vim.extraConfig; - - vam = with pkgs; { - pluginDictionaries = [ - # UI - { name = "undotree"; } - { name = "gruvbox-community"; } - { name = "gitgutter"; } - { name = "lightline-vim"; } - { name = "vim-dirvish"; } - - # Motions - { name = "camelcasemotion"; } - { name = "surround"; } - { name = "targets-vim"; } - - # Frameworks - { name = "deoplete-nvim"; } - { name = "neosnippet"; } - { name = "neosnippet-snippets"; } - { name = "neoformat"; } - { name = "ctrlp"; } - # Syntax generic completion for deoplete - { name = "neco-syntax"; } - - # Languages - { name = "vim-polyglot"; } - { name = "editorconfig-vim"; } - # Vim completion for deoplete - { name = "neco-vim"; } - { name = "deoplete-zsh"; } - { name = "vim-pandoc"; } - { name = "vim-pandoc-syntax"; } - - # Languages (but not programming languages) - { name = "vim-grammarous"; } - - # Other - { name = "tmux-complete-vim"; } - { name = "fugitive"; } - { name = "rhubarb"; } - { name = "repeat"; } - { name = "vim-unimpaired"; } - { name = "tabular"; } - { name = "vimwiki"; } - { name = "vim-abolish"; } - - ] ++ config.vim.extraPlugins; +let + inherit (pkgs.unstable) vimPlugins wrapNeovim; - }; + neovim-unwrapped = inputs.neovim-master.defaultPackage.${config.nixpkgs.system}; + + cfg = config.vim; + + myConfigPackage = with lib; + pkgs.writeTextDir + "share/vim-plugins/myConfig/lua/myConfig.lua" + '' + -- Autogenerated variables from the NixOS configuration + + ${(concatStringsSep + "\n" + (mapAttrsToList + (variable: value: "vim.g.${variable} = ${value}") + cfg.variables))} + + -- vim.lua from the NixOS configuration + + ${builtins.readFile ../dotfiles/vim.lua} + + -- luaConfig from the NixOS configuration + + ${cfg.luaConfig} + ''; + + myNeovim = wrapNeovim neovim-unwrapped { + configure = { + inherit (config.vim) beforePlugins; + + customRC = '' + autocmd VimEnter * lua require("myConfig") + + ${cfg.extraConfig} + ''; + + packages.myVimPackage = with vimPlugins; { + start = [ + myConfigPackage + + # Dependencies + plenary-nvim + popup-nvim + + # UI + undotree + gruvbox-community + lualine-nvim + gitsigns-nvim + vim-dirvish + lsp-status-nvim + + completion-nvim + completion-buffers + snippets-nvim + + telescope-nvim + + # Treesitter + nvim-treesitter + completion-treesitter + nvim-treesitter-textobjects + nvim-treesitter-context + + # Motions + camelcasemotion + surround + targets-vim + + neoformat + + # Languages + vim-polyglot + editorconfig-vim + vim-pandoc + vim-pandoc-syntax + + # Languages (but not programming languages) + vim-grammarous + + # Other + tmux-complete-vim + fugitive + rhubarb + repeat + vim-unimpaired + tabular + vim-abolish + ] ++ config.vim.extraPlugins; + }; + }; }; -}); -in { +in +{ options.vim = with lib; { variables = mkOption { type = types.attrsOf types.str; - default = { - dominant_color = "'${config.theme.colors.dominant}'"; - ripgrep_path = "'${pkgs.ripgrep}/bin/rg'"; - fd_path = "'${pkgs.fd}/bin/fd'"; - }; + default = {}; description = '' Extra global variables to add at the beginning of the vim configuration. @@ -85,17 +112,11 @@ in { }; extraPlugins = mkOption { - type = types.listOf (types.attrsOf types.str); - default = []; + type = with types; listOf package; + default = [ ]; description = "Names of extra plugins to add"; }; - extraRepoPlugins = mkOption { - type = types.listOf (types.attrsOf types.str); - default = []; - description = "Names of extra plugins to add that are present in the local repository"; - }; - beforePlugins = mkOption { type = types.lines; default = ""; @@ -107,9 +128,30 @@ in { default = ""; description = "Extra lines to add at the end of the vim configuration"; }; + + luaConfig = mkOption { + type = types.lines; + default = ""; + description = "Lua Neovim configuration"; + }; + + wrappedPackage = mkOption { + type = types.package; + description = "Resulting wrapped Neovim package"; + readOnly = true; + }; }; config = { + vim = { + wrappedPackage = myNeovim; + variables = { + dominant_color = "'${config.theme.colors.dominant}'"; + ripgrep_path = "'${pkgs.ripgrep}/bin/rg'"; + fd_path = "'${pkgs.fd}/bin/fd'"; + }; + }; + environment.systemPackages = with pkgs; [ myNeovim ]; @@ -119,13 +161,13 @@ in { }; home-manager.users.minijackson = { ... }: - { - xdg.dataFile."nvim/backup/.keep".text = ""; - }; + { + xdg.dataFile."nvim/backup/.keep".text = ""; + }; home-manager.users.root = { ... }: - { - xdg.dataFile."nvim/backup/.keep".text = ""; - }; + { + xdg.dataFile."nvim/backup/.keep".text = ""; + }; }; } diff --git a/dotfiles/vim-dev.lua b/dotfiles/vim-dev.lua new file mode 100644 index 0000000..6b78022 --- /dev/null +++ b/dotfiles/vim-dev.lua @@ -0,0 +1,61 @@ +local lspconfig = require("lspconfig") + +function on_attach(client, bufnr) + local function buf_set_keymap(...) + vim.api.nvim_buf_set_keymap(bufnr, ...) + end + + local opts = { noremap = true, silent = true } + + buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) + + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + + buf_set_keymap('n', 'sa', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('n', 'se', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + buf_set_keymap('n', 'sl', 'lua vim.lsp.diagnostic.set_loclist()', opts) + buf_set_keymap('n', 'sr', 'lua vim.lsp.buf.rename()', opts) + + buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + + -- Capability specific + + -- print(vim.inspect(client.resolved_capabilities)) + + if client.resolved_capabilities.document_formatting then + buf_set_keymap("n", "sf", "lua vim.lsp.buf.formatting()", opts) + end + if client.resolved_capabilities.document_range_formatting then + buf_set_keymap("v", "sf", "lua vim.lsp.buf.range_formatting()", opts) + end + + -- Rust specific + buf_set_keymap("n", "sh", "RustToggleInlayHints", opts) + + require("completion").on_attach() +end + +function setup_lsp_with(servers) + for _, server in ipairs(servers) do + lspconfig[server].setup { + cmd = { vim.g[server .. "_path"] }, + on_attach = on_attach, + } + end +end + +setup_lsp_with { + "clangd", + "elixirls", + "pyls", +} + +require("rust-tools").setup { + server = { + cmd = { vim.g.rust_analyzer_path }, + on_attach = on_attach, + } +} diff --git a/dotfiles/vim.lua b/dotfiles/vim.lua new file mode 100644 index 0000000..1acff0d --- /dev/null +++ b/dotfiles/vim.lua @@ -0,0 +1,223 @@ +-- Options +---------- + +vim.o.undofile = true +vim.o.backup = true +vim.cmd "set backupdir-=." + +vim.o.mouse = "a" + +vim.o.ignorecase = true +vim.o.smartcase = true + +vim.o.smartindent = true + +vim.o.tabstop = 4 +vim.o.shiftwidth = 4 + +vim.o.inccommand = "split" + +vim.o.scrolloff = 1 +vim.o.sidescrolloff = 5 + +vim.o.colorcolumn = "80" +vim.o.cursorline = true + +vim.o.title = true + +vim.o.wildmode = "longest:full,full" +vim.o.completeopt = "menu,menuone,preview,noinsert,noselect" + +-- Use ripgrep +vim.o.grepprg = vim.g.ripgrep_path .. " --vimgrep --smart-case" +vim.o.grepformat = "%f:%l:%c:%m" .. vim.o.grepformat + +vim.o.termguicolors = true +vim.o.background = "dark" + +-- Mode already shown by the status line +vim.o.showmode = false + +-- Do not set "trail:-" because it messes up the highlighting +vim.o.listchars = "tab:│ ,extends:>,precedes:<,nbsp:+" +vim.wo.list = true +vim.o.fillchars = "fold:─,vert:│" + +-- Leaders +---------- + +vim.g.maplocalleader = "," +vim.g.mapleader = ";" + +-- Misc +------- + +-- From neovim#14420 +-- Restores the position of previously opened files +vim.cmd [[ + augroup LastCursorPos + autocmd! + autocmd BufReadPost * if @% !~# "\.git[\/\\]COMMIT_EDITMSG$" && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + augroup end +]] + +-- Highlight yanked text +vim.cmd "autocmd TextYankPost * silent! lua vim.highlight.on_yank()" + +vim.g.tex_flavor = "latex" + +vim.cmd "colorscheme gruvbox" + +-- Mappings +----------- + +local map = vim.api.nvim_set_keymap +local mapopts = { noremap = true, silent = true } + +vim.fn["camelcasemotion#CreateMotionMappings"] "" + +map("n", "=of", [[:set =(&formatoptions =~ "a") ? 'formatoptions-=a' : 'formatoptions+=a']], mapopts) + +-- Plugins +---------- + +-- Gitsigns + +require('gitsigns').setup { + keymaps = { + noremap = true, + buffer = true, + silent = true, + + ['n ]c'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns\".next_hunk()'"}, + ['n [c'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns\".prev_hunk()'"}, + + ['n hs'] = 'lua require"gitsigns".stage_hunk()', + ['n hu'] = 'lua require"gitsigns".undo_stage_hunk()', + ['n hr'] = 'lua require"gitsigns".reset_hunk()', + ['n hR'] = 'lua require"gitsigns".reset_buffer()', + ['n hp'] = 'lua require"gitsigns".preview_hunk()', + ['n hb'] = 'lua require"gitsigns".blame_line()', + + -- Text objects + ['o ih'] = ':lua require"gitsigns".select_hunk()', + ['x ih'] = ':lua require"gitsigns".select_hunk()', + } +} + +-- Treesitter + +require('nvim-treesitter.configs').setup { + highlight = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + }, + }, + indent = { + enable = true, + }, + matchup = { + enable = true, + }, + textobjects = { + select = { + enable = true, + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + }, + }, + + move = { + enable = true, + goto_next_start = { + ["]m"] = "@function.outer", + ["]]"] = "@class.outer", + }, + goto_next_end = { + ["]M"] = "@function.outer", + ["]["] = "@class.outer", + }, + goto_previous_start = { + ["[m"] = "@function.outer", + ["[["] = "@class.outer", + }, + goto_previous_end = { + ["[M"] = "@function.outer", + ["[]"] = "@class.outer", + }, + }, + }, +} + +vim.o.foldmethod = 'expr' +vim.o.foldexpr = 'nvim_treesitter#foldexpr()' + +-- Completion-nvim + +vim.g.completion_chain_complete_list = { + default = { + { + complete_items = { 'lsp', 'ts', 'path', 'snippet', 'buffers', 'tmux', }, + } + }, +} + +vim.cmd [[autocmd BufEnter * lua require'completion'.on_attach()]] + +local map = vim.api.nvim_set_keymap + +vim.g.completion_enable_snippet = "snippets.nvim" + +-- Telescope + +map("n", "fb", "Telescope buffers", mapopts) +map("n", "ff", "Telescope find_files", mapopts) +map("n", "fg", "Telescope live_grep", mapopts) +map("n", "fh", "Telescope help_tags", mapopts) +map("n", "ft", "Telescope treesitter", mapopts) + +-- Lualine + +local lsp_status = require('lsp-status') +lsp_status.config { + indicator_errors = "err:", + indicator_hint = "hint:", + indicator_info = "info:", + indicator_ok = "ok", + indicator_warnings = "warn:", + spinner_frames = {""}, + status_symbol = "lsp:", +} +lsp_status.register_progress() + +function LspStatus() + if #vim.lsp.buf_get_clients() < 1 then return "" end + + return lsp_status.status() +end + +require("lualine").setup { + options = { + component_separators = "", + icons_enabled = false, + section_separators = "", + }, + sections = { + lualine_c = {'filename', LspStatus}, + }, +} + +-- Snippets.nvim + +require("snippets").use_suggested_mappings() diff --git a/dotfiles/vimrc.vim b/dotfiles/vimrc.vim deleted file mode 100644 index a0451c6..0000000 --- a/dotfiles/vimrc.vim +++ /dev/null @@ -1,139 +0,0 @@ -" Some global variables are defined in ../vim.nix - -" Better default options {{{ - -set undofile -set backup -set backupdir-=. - -set mouse=a - -set ignorecase -set smartcase - -set smartindent -set tabstop=4 -set shiftwidth=4 - -set inccommand=split - -set scrolloff=1 -set sidescrolloff=5 - -set colorcolumn=80 -set cursorline - -set modeline - -set title - -set wildmode=longest:full,full - -let g:maplocalleader = ',' -let g:mapleader = ';' - -" If previously opened jump to the last position in the file -au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif - -let &grepprg = g:ripgrep_path . ' --vimgrep $*' -let &grepformat = '%f:%l:%c:%m,' . &grepformat - -let g:tex_flavor = 'latex' - -" }}} - -" Colors, Statusline, Tabline, Code display {{{ - -set termguicolors -let g:gruvbox_contrast_dark = 'soft' -let g:gruvbox_italic = 1 -set background=dark -colorscheme gruvbox - -" Doesn't do anything because the tabline gets overwritten by lightline -"exe 'hi! TabLineSel guifg=' . g:dominant_color - -let g:lightline = { - \ 'colorscheme': 'gruvbox', - \ 'subseparator': { 'left': '|', 'right': '|' }, - \ 'tab_linesubseparator': { 'left': '|', 'right': '|' }, - \ } - -set noshowmode - -" Do not set "trail:-" because it messes up the highlighting -set listchars=tab:│\ ,extends:>,precedes:<,nbsp:+ -set list - -set fillchars=fold:─,vert:│ - -highlight ExtraWhitespace term=inverse cterm=inverse gui=inverse -" Show trailing whitespace and spaces before tabs: -autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL - -" }}} - -" Mappings {{{ - -call camelcasemotion#CreateMotionMappings(g:maplocalleader) - -nmap =of :set =(&formatoptions =~ "a") ? 'formatoptions-=a' : 'formatoptions+=a' - -" }}} - -set completefunc=syntaxcomplete#Complete -set completeopt+=noinsert,noselect - -" Deoplete {{{ - -let g:deoplete#enable_at_startup = 1 - -" }}} - -" Neosnippets {{{ - -imap (neosnippet_expand_or_jump) -smap (neosnippet_expand_or_jump) -xmap (neosnippet_expand_target) - -set conceallevel=2 -set concealcursor=nv - -" }}} - -" CtrlP {{{ -let g:ctrlp_user_command = g:fd_path . ' --type f --color never "" %s' -let g:ctrlp_use_caching = 0 -" }}} - -" LanguageClient {{{ -let g:LanguageClient_loggingFile = stdpath('data') . '/LanguageClient.log' -let g:LanguageClient_serverStderr = stdpath('data') . '/LanguageServer.log' -" }}} - -" VimWiki {{{ - " {'path': '~/Documents/Wiki', 'path_html': '~/Documents/Wiki/html'} \ -let g:vimwiki_list = [ - \ {'path': '~/Documents/Wiki/personal', - \ 'path_html': '~/Documents/Wiki/personal/html', - \ 'auto_tags': 1}, - \ {'path': '~/Documents/Wiki/science', 'path_html': '~/Documents/Wiki/science/html', 'auto_tags': 1}, - \ {'path': '~/Documents/Wiki/work', 'path_html': '~/Documents/Wiki/work/html', 'auto_tags': 1}, -\ ] - -let g:vimwiki_global_ext = 0 - -let g:vimwiki_auto_header = 1 -let g:vimwiki_hl_headers = 1 -let g:vimwiki_hl_cb_checked = 1 -let g:vimwiki_html_header_numbering = 2 -let g:vimwiki_html_header_numbering_sym = '.' - -let g:vimwiki_links_header_level = 2 -let g:vimwiki_tags_header_level = 2 -let g:vimwiki_toc_header_level = 2 - -call deoplete#custom#var('omni', 'input_patterns', { 'vimwiki': '\[\[\w*|\:\w+' }) -" }}} - -" vim: fdm=marker diff --git a/flake.lock b/flake.lock index c0fde98..a1eb5e8 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,26 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1618217525, - "narHash": "sha256-WGrhVczjXTiswQaoxQ+0PTfbLNeOQM6M36zvLn78AYg=", + "lastModified": 1620759905, + "narHash": "sha256-WiyWawrgmyN0EdmiHyG2V+fqReiVi8bM9cRdMaKQOFg=", "owner": "numtide", "repo": "flake-utils", - "rev": "c6169a2772643c4a93a0b5ac1c61e296cba68544", + "rev": "b543720b25df6ffdfcf9227afafc5b8c1fabfae8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1610051610, + "narHash": "sha256-U9rPz/usA1/Aohhk7Cmc2gBrEEKRzcW4nwPWMPwja4Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3982c9903e93927c2164caa727cd3f6a0e6d14cc", "type": "github" }, "original": { @@ -36,13 +51,36 @@ "type": "github" } }, + "neovim-master": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1620779525, + "narHash": "sha256-k4ePrffhuZoSDqZMOMHx1Rb/ehd6cjvJvc/Wh9Wr8Rg=", + "owner": "neovim", + "repo": "neovim", + "rev": "61aefaf2993c0b55f6123ba4b0bd41b1caf1fcd3", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1618750622, - "narHash": "sha256-AfRXbXH1t7WgDiHt+CWofoLuy12nfFTY4pZoGfPueQo=", + "lastModified": 1620808985, + "narHash": "sha256-cf/+g1RVawT0rcKmfh2nf/lgnSrj9YZS+1PkCFmoeJQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b2a189a8618fc1ba61593016fe5699b38971b89f", + "rev": "327368f98c6a927a84aed3c2f2fd1a7f6983e855", "type": "github" }, "original": { @@ -54,16 +92,16 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1618755104, - "narHash": "sha256-boqugaFW1nRuyu0w774WGgaaCEfCxn0Nf8z8GJziVmU=", + "lastModified": 1620741912, + "narHash": "sha256-TvAEtovofPE7CQiRt2+LNmn2qeCMF1gLXAfs34a0zqA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5a333c5f091b88007caf1041bbb651867a449c5a", + "rev": "ca26ea50d66737922d0edfaaf07449576ece7f8c", "type": "github" }, "original": { "owner": "NixOS", - "ref": "master", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -72,6 +110,7 @@ "inputs": { "flake-utils": "flake-utils", "home-manager": "home-manager", + "neovim-master": "neovim-master", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } diff --git a/flake.nix b/flake.nix index 44f4394..c06def2 100644 --- a/flake.nix +++ b/flake.nix @@ -2,14 +2,18 @@ description = "My NixOS configurations"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-20.09"; - inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs/master"; + inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.home-manager = { url = "github:nix-community/home-manager/release-20.09"; inputs.nixpkgs.follows = "nixpkgs"; }; + inputs.neovim-master = { + url = "github:neovim/neovim?dir=contrib"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; - outputs = inputs @ { self, nixpkgs, nixpkgs-unstable, flake-utils, home-manager }: { + outputs = inputs @ { self, nixpkgs, home-manager, ... }: { nixosModules = { default = { ... }: { @@ -59,6 +63,7 @@ usecases.desktop = { default = (import ./usecases/desktop/default.nix inputs); + development = (import ./usecases/desktop/development.nix inputs); networkManager = (import ./usecases/desktop/networking/network-manager.nix inputs); }; @@ -82,19 +87,20 @@ ]; }; - testDesktop = nixpkgs.lib.nixosSystem { + testPlainDesktop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + self.nixosModules.test + self.nixosModules.profiles.desktop + ]; + }; + + testDevDesktop = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ self.nixosModules.test self.nixosModules.profiles.desktop - ({ modulesPath, ... }: { - imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ]; - - virtualisation = { - memorySize = 2048; - cores = 3; - }; - }) + self.nixosModules.usecases.desktop.development ]; }; diff --git a/profiles/desktop.nix b/profiles/desktop.nix index 2546b76..0498aaf 100644 --- a/profiles/desktop.nix +++ b/profiles/desktop.nix @@ -18,14 +18,6 @@ inputs: pavucontrol pandoc poppler_utils - # TODO: on development workstation - /* - rr - rtags - gcc - clang - clang-tools - */ aspell aspellDicts.en aspellDicts.en-computers diff --git a/usecases/desktop/development.nix b/usecases/desktop/development.nix new file mode 100644 index 0000000..022482d --- /dev/null +++ b/usecases/desktop/development.nix @@ -0,0 +1,39 @@ +inputs: + +{ config, pkgs, ... }: + +let + inherit (pkgs.unstable) + clang-tools + elixir_ls + rust-analyzer-unwrapped + + vimPlugins; + + inherit (pkgs.unstable.python3Packages) python-language-server; + +in +{ + users.extraUsers.minijackson.packages = with pkgs; [ + rr + rtags + gcc + clang + clang-tools + ]; + + vim = { + extraPlugins = with vimPlugins; [ + nvim-lspconfig + rust-tools-nvim + ]; + luaConfig = builtins.readFile ../../dotfiles/vim-dev.lua; + + variables = { + clangd_path = "'${clang-tools}/bin/clangd'"; + elixirls_path = "'${elixir_ls}/bin/elixir-ls'"; + pyls_path = "'${python-language-server}/bin/pyls'"; + rust_analyzer_path = "'${rust-analyzer-unwrapped}/bin/rust-analyzer'"; + }; + }; +} -- cgit v1.2.3