From 4fc9dd3bbb56a0f976733b5169be58820ed5be6f Mon Sep 17 00:00:00 2001 From: Soispha Peetz Date: Thu, 26 Nov 2026 01:07:25 +0100 Subject: modules/nvim: Import all the modules via mkMerge This means that we use only one `lib.mkIf cfg.enable`, so when there is no nixvim module loaded it does not error. --- modules/by-name/nv/nvim/autocmds/default.nix | 10 +- modules/by-name/nv/nvim/clipboard/default.nix | 10 +- modules/by-name/nv/nvim/mappings/default.nix | 10 +- modules/by-name/nv/nvim/module.nix | 127 ++++++------ modules/by-name/nv/nvim/options/default.nix | 3 +- modules/by-name/nv/nvim/performance/default.nix | 10 +- .../by-name/nv/nvim/plgs/colorscheme/default.nix | 7 +- .../by-name/nv/nvim/plgs/comment-nvim/default.nix | 10 +- modules/by-name/nv/nvim/plgs/femaco/default.nix | 5 +- .../by-name/nv/nvim/plgs/goto-preview/default.nix | 7 +- modules/by-name/nv/nvim/plgs/harpoon/default.nix | 10 +- modules/by-name/nv/nvim/plgs/lf-nvim/default.nix | 10 +- modules/by-name/nv/nvim/plgs/lsp/default.nix | 66 +++--- .../by-name/nv/nvim/plgs/lsp/keymaps/default.nix | 10 +- .../by-name/nv/nvim/plgs/lsp/servers/default.nix | 30 +-- .../nv/nvim/plgs/lsp/servers/servers/bashls.nix | 22 -- .../plgs/lsp/servers/servers/bashls/default.nix | 16 ++ .../nv/nvim/plgs/lsp/servers/servers/ccls.nix | 22 -- .../nvim/plgs/lsp/servers/servers/ccls/default.nix | 16 ++ .../nv/nvim/plgs/lsp/servers/servers/ltex.nix | 58 ------ .../nvim/plgs/lsp/servers/servers/ltex/default.nix | 51 +++++ .../nv/nvim/plgs/lsp/servers/servers/lua-ls.nix | 25 --- .../plgs/lsp/servers/servers/lua-ls/default.nix | 19 ++ .../nv/nvim/plgs/lsp/servers/servers/nil-ls.nix | 27 --- .../plgs/lsp/servers/servers/nil-ls/default.nix | 21 ++ .../nv/nvim/plgs/lsp/servers/servers/openscad.nix | 48 ----- .../plgs/lsp/servers/servers/openscad/default.nix | 41 ++++ .../plgs/lsp/servers/servers/quick-lint-js.nix | 31 --- .../lsp/servers/servers/quick-lint-js/default.nix | 24 +++ .../nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix | 26 --- .../plgs/lsp/servers/servers/ruff-lsp/default.nix | 19 ++ .../plgs/lsp/servers/servers/rust-analyzer.nix | 34 --- .../lsp/servers/servers/rust-analyzer/default.nix | 28 +++ .../nv/nvim/plgs/lsp/servers/servers/texlab.nix | 24 --- .../plgs/lsp/servers/servers/texlab/default.nix | 18 ++ .../nv/nvim/plgs/lsp/servers/servers/zls.nix | 30 --- .../nvim/plgs/lsp/servers/servers/zls/default.nix | 23 +++ modules/by-name/nv/nvim/plgs/lspkind/default.nix | 10 +- .../by-name/nv/nvim/plgs/ltex_extra/default.nix | 11 +- modules/by-name/nv/nvim/plgs/lualine/default.nix | 229 ++++++++++----------- modules/by-name/nv/nvim/plgs/luasnip/default.nix | 11 +- modules/by-name/nv/nvim/plgs/neorg/default.nix | 8 +- modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix | 10 +- modules/by-name/nv/nvim/plgs/nvim-lint/default.nix | 7 +- modules/by-name/nv/nvim/plgs/telescope/default.nix | 40 ++-- .../nv/nvim/plgs/telescope/defaults/default.nix | 10 +- .../plgs/telescope/extensions/bibtex/default.nix | 36 ---- .../nvim/plgs/telescope/extensions/bibtex/tex.lua | 70 ------- .../nv/nvim/plgs/telescope/extensions/default.nix | 23 ++- .../telescope/extensions/ext/bibtex/default.nix | 34 +++ .../plgs/telescope/extensions/ext/bibtex/tex.lua | 70 +++++++ .../telescope/extensions/ext/frecency/default.nix | 31 +++ .../extensions/ext/fzy-native/default.nix | 14 ++ .../telescope/extensions/ext/rooter/default.nix | 16 ++ .../telescope/extensions/ext/rooter/lua/rooter.lua | 86 ++++++++ .../plgs/telescope/extensions/frecency/default.nix | 37 ---- .../telescope/extensions/fzy-native/default.nix | 20 -- .../plgs/telescope/extensions/rooter/default.nix | 22 -- .../telescope/extensions/rooter/lua/rooter.lua | 86 -------- .../plgs/telescope/extensions/symbols/default.nix | 68 ------ .../nv/nvim/plgs/telescope/keymaps/default.nix | 10 +- .../by-name/nv/nvim/plgs/todo-comments/default.nix | 10 +- .../by-name/nv/nvim/plgs/treesitter/default.nix | 7 +- modules/by-name/nv/nvim/plgs/vim-tex/default.nix | 8 +- modules/by-name/nv/nvim/plgs/which-key/default.nix | 10 +- 65 files changed, 835 insertions(+), 1107 deletions(-) delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls.nix create mode 100644 modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua create mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/ext/bibtex/default.nix create mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/ext/bibtex/tex.lua create mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/ext/frecency/default.nix create mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/ext/fzy-native/default.nix create mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/ext/rooter/default.nix create mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/ext/rooter/lua/rooter.lua delete mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix delete mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua delete mode 100644 modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix (limited to 'modules/by-name/nv/nvim') diff --git a/modules/by-name/nv/nvim/autocmds/default.nix b/modules/by-name/nv/nvim/autocmds/default.nix index 706f1bbd..4d7b4894 100644 --- a/modules/by-name/nv/nvim/autocmds/default.nix +++ b/modules/by-name/nv/nvim/autocmds/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - config.home-manager.users.soispha = lib.mkIf cfg.enable { +{config}: { + home-manager.users.soispha = { programs.nixvim = { autoGroups = { cursor_off = {clear = true;}; diff --git a/modules/by-name/nv/nvim/clipboard/default.nix b/modules/by-name/nv/nvim/clipboard/default.nix index f6348e44..26b9ce1a 100644 --- a/modules/by-name/nv/nvim/clipboard/default.nix +++ b/modules/by-name/nv/nvim/clipboard/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim = { clipboard.providers = { wl-copy.enable = true; }; diff --git a/modules/by-name/nv/nvim/mappings/default.nix b/modules/by-name/nv/nvim/mappings/default.nix index 683b0465..6cd34b11 100644 --- a/modules/by-name/nv/nvim/mappings/default.nix +++ b/modules/by-name/nv/nvim/mappings/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - config.home-manager.users.soispha = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha = { programs.nixvim = { globals = { mapleader = " "; diff --git a/modules/by-name/nv/nvim/module.nix b/modules/by-name/nv/nvim/module.nix index 17cc8dcc..66ba7ad6 100644 --- a/modules/by-name/nv/nvim/module.nix +++ b/modules/by-name/nv/nvim/module.nix @@ -21,18 +21,15 @@ useShards = false; baseDirectory = ./plgs; fileName = "default.nix"; + finalizeFunction = name: path: import path {inherit config lib pkgs extra_lib;}; }); -in { - imports = - [ - ./autocmds - ./clipboard - ./mappings - ./options - ./performance - ] - ++ plgs; + autocmds = import ./autocmds {inherit config;}; + clipboard = import ./clipboard {}; + mappings = import ./mappings {}; + options = import ./options {inherit config lib;}; + performance = import ./performance {}; +in { options.soispha.programs.nvim = { enable = lib.mkEnableOption "custom nvim config"; shell = lib.mkOption { @@ -41,62 +38,72 @@ in { }; }; - config = lib.mkIf cfg.enable { - soispha.services.unison.pathsToSync = [ - "~/.local/state/nvim" - ]; - vhack.persist.userDirectories.soispha = [ - ".local/state/nvim" - ]; + config = lib.mkIf cfg.enable ( + lib.mkMerge (plgs + ++ [ + autocmds + clipboard + mappings + options + performance + { + soispha.services.unison.pathsToSync = [ + "~/.local/state/nvim" + ]; + vhack.persist.userDirectories.soispha = [ + ".local/state/nvim" + ]; - home-manager.users.soispha = { - imports = [ - extra_modules.home.nixvim - ]; + home-manager.users.soispha = { + imports = [ + extra_modules.home.nixvim + ]; - home.sessionVariables = { - EDITOR = "nvim"; - VISUAL = "nvim"; - CODEEDITOR = "nvim"; - }; + home.sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + CODEEDITOR = "nvim"; + }; - programs.nixvim = { - enable = true; + programs.nixvim = { + enable = true; - # Use my global nixpkgs set, instead of constructing a separate one. - nixpkgs.useGlobalPackages = true; + # Use my global nixpkgs set, instead of constructing a separate one. + nixpkgs.useGlobalPackages = true; - # source: https://www.patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Neovim - extraConfigLuaPre = lib.mkBefore '' - --------------------------------------------------------------------------- - -- - -- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ - -- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ - -- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ - -- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ - -- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ - -- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ - -- - --------------------------------------------------------------------------- - ''; + # source: https://www.patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Neovim + extraConfigLuaPre = lib.mkBefore '' + --------------------------------------------------------------------------- + -- + -- ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ + -- ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ + -- ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ + -- ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ + -- ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ + -- ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + -- + --------------------------------------------------------------------------- + ''; - extraPackages = [ - /* - These are mostly linters and formatters used for different file types. - Including them here is fine, as they are not necessarily-sync able to different people. - */ - # nix - pkgs.alejandra - pkgs.statix + extraPackages = [ + /* + These are mostly linters and formatters used for different file types. + Including them here is fine, as they are not necessarily-sync able to different people. + */ + # nix + pkgs.alejandra + pkgs.statix - # yaml - pkgs.yamllint + # yaml + pkgs.yamllint - # shell - pkgs.shellcheck - pkgs.shfmt - ]; - }; - }; - }; + # shell + pkgs.shellcheck + pkgs.shfmt + ]; + }; + }; + } + ]) + ); } diff --git a/modules/by-name/nv/nvim/options/default.nix b/modules/by-name/nv/nvim/options/default.nix index 301f0ac0..8d720aba 100644 --- a/modules/by-name/nv/nvim/options/default.nix +++ b/modules/by-name/nv/nvim/options/default.nix @@ -10,11 +10,10 @@ { config, lib, - ... }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim.opts = lib.mkIf cfg.enable { + home-manager.users.soispha.programs.nixvim.opts = { autoindent = true; # copy indent from previous line cindent = true; # use c like indenting rules breakindent = true; # continue indent visually diff --git a/modules/by-name/nv/nvim/performance/default.nix b/modules/by-name/nv/nvim/performance/default.nix index a392a672..d3e1f9ca 100644 --- a/modules/by-name/nv/nvim/performance/default.nix +++ b/modules/by-name/nv/nvim/performance/default.nix @@ -1,11 +1,5 @@ -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim = { performance = { combinePlugins = { enable = true; diff --git a/modules/by-name/nv/nvim/plgs/colorscheme/default.nix b/modules/by-name/nv/nvim/plgs/colorscheme/default.nix index f8cd5892..e4ae5038 100644 --- a/modules/by-name/nv/nvim/plgs/colorscheme/default.nix +++ b/modules/by-name/nv/nvim/plgs/colorscheme/default.nix @@ -9,13 +9,10 @@ # If not, see . { pkgs, - config, lib, ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +}:{ + home-manager.users.soispha.programs.nixvim = { # TODO: package nightfox though a module extraConfigLuaPost = '' ${lib.strings.fileContents ./lua/nightfox.lua} diff --git a/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix b/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix index 68a88d32..c23cd84d 100644 --- a/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim = { plugins.comment = { enable = true; settings = { diff --git a/modules/by-name/nv/nvim/plgs/femaco/default.nix b/modules/by-name/nv/nvim/plgs/femaco/default.nix index eac6b393..d94b546c 100644 --- a/modules/by-name/nv/nvim/plgs/femaco/default.nix +++ b/modules/by-name/nv/nvim/plgs/femaco/default.nix @@ -9,11 +9,8 @@ # If not, see . { lib, - config, ... -}: let - cfg = config.soispha.programs.nvim; -in { +}: { # TODO: Re-active this plugin, when it does no longer depend on `treesitter-legacy` <2026-01-18> home-manager.users.soispha.programs.nixvim = lib.mkIf false { plugins.femaco = { diff --git a/modules/by-name/nv/nvim/plgs/goto-preview/default.nix b/modules/by-name/nv/nvim/plgs/goto-preview/default.nix index 93761dfd..a3adb465 100644 --- a/modules/by-name/nv/nvim/plgs/goto-preview/default.nix +++ b/modules/by-name/nv/nvim/plgs/goto-preview/default.nix @@ -10,12 +10,9 @@ { pkgs, lib, - config, ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +}: { + home-manager.users.soispha.programs.nixvim = { # TODO: package goto-preview though a module extraConfigLuaPost = '' ${lib.strings.fileContents ./lua/goto-preview.lua} diff --git a/modules/by-name/nv/nvim/plgs/harpoon/default.nix b/modules/by-name/nv/nvim/plgs/harpoon/default.nix index c85c7c80..a12ddfc2 100644 --- a/modules/by-name/nv/nvim/plgs/harpoon/default.nix +++ b/modules/by-name/nv/nvim/plgs/harpoon/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - lib, - config, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +{lib, ...}: { + home-manager.users.soispha.programs.nixvim = { plugins.harpoon.enable = true; keymaps = diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix index e652a60d..3ad264dc 100644 --- a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix @@ -7,15 +7,9 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - lib, - config, - ... -}: let - cfg = config.soispha.programs.nvim; -in { +{...}: { # TODO: change the nvim path, when I change the path with lf - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + home-manager.users.soispha.programs.nixvim = { plugins.lf = { enable = true; diff --git a/modules/by-name/nv/nvim/plgs/lsp/default.nix b/modules/by-name/nv/nvim/plgs/lsp/default.nix index 27a6f909..895cf482 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/default.nix @@ -8,37 +8,41 @@ # You should have received a copy of the License along with this program. # If not, see . { - config, lib, + extra_lib, + config, + pkgs, ... }: let - cfg = config.soispha.programs.nvim; -in { - imports = [ - ./keymaps - ./servers - ]; - home-manager.users.soispha.programs.nixvim.plugins.lsp = lib.mkIf cfg.enable { - enable = true; - onAttach = - "" - # + '' - # function(client, bufnr) - # -- Enable completion triggered by - # -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - # end - # '' - ; - preConfig = '' - vim.diagnostic.config({ - underline = true, - -- virtual_text = true, - virtual_text = { - source = "always", -- Or "if_many" - }, - update_in_insert = true, - severity_sort = true, - }, nil); - ''; - }; -} + keymaps = import ./keymaps {}; + servers = import ./servers {inherit extra_lib config lib pkgs;}; +in + lib.mkMerge [ + keymaps + servers + { + home-manager.users.soispha.programs.nixvim.plugins.lsp = { + enable = true; + onAttach = + "" + # + '' + # function(client, bufnr) + # -- Enable completion triggered by + # -- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + # end + # '' + ; + preConfig = '' + vim.diagnostic.config({ + underline = true, + -- virtual_text = true, + virtual_text = { + source = "always", -- Or "if_many" + }, + update_in_insert = true, + severity_sort = true, + }, nil); + ''; + }; + } + ] diff --git a/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix b/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix index 7cc9f6d5..13f31ee7 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim = { plugins.lsp.keymaps = { diagnostic = { "N" = { diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix index 0e7be6e8..52e478a5 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix @@ -7,18 +7,18 @@ # # You should have received a copy of the License along with this program. # If not, see . -{...}: { - imports = [ - ./servers/bashls.nix - ./servers/ccls.nix - ./servers/ltex.nix - ./servers/lua-ls.nix - ./servers/nil-ls.nix - ./servers/openscad.nix - ./servers/quick-lint-js.nix - ./servers/ruff-lsp.nix - ./servers/rust-analyzer.nix - ./servers/texlab.nix - ./servers/zls.nix - ]; -} +{ + extra_lib, + config, + lib, + pkgs, + ... +}: let + servers = builtins.attrValues (extra_lib.mkByName { + useShards = false; + baseDirectory = ./servers; + fileName = "default.nix"; + finalizeFunction = name: path: import path {inherit config lib pkgs;}; + }); +in + lib.mkMerge servers diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix deleted file mode 100644 index 8d2b0d03..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix +++ /dev/null @@ -1,22 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - lib, - config, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.lsp.servers = { - bashls.enable = true; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls/default.nix new file mode 100644 index 00000000..1ed049c4 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls/default.nix @@ -0,0 +1,16 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + home-manager.users.soispha.programs.nixvim = { + plugins.lsp.servers = { + bashls.enable = true; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix deleted file mode 100644 index eed7f349..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix +++ /dev/null @@ -1,22 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.lsp.servers = { - ccls.enable = true; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls/default.nix new file mode 100644 index 00000000..59e79cd4 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls/default.nix @@ -0,0 +1,16 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + home-manager.users.soispha.programs.nixvim = { + plugins.lsp.servers = { + ccls.enable = true; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix deleted file mode 100644 index 5c0024f0..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix +++ /dev/null @@ -1,58 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.lsp.servers = { - ltex = let - filetypes = [ - "java" - "cpp" - "shell" - "bash" - - "bibtex" - "context" - "context.tex" - "latex" - "tex" - - "markdown" - "org" - "restructuredtext" - "rsweave" - - "git-commit" - "gitcommit" - - "mail" - ]; - in { - enable = true; - package = pkgs.ltex-ls-plus; - inherit filetypes; - settings = { - enabled = filetypes; - completionEnabled = false; - language = "en-CA"; - additionalRules = { - enablePickyRules = true; - }; - }; - }; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex/default.nix new file mode 100644 index 00000000..502ad696 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex/default.nix @@ -0,0 +1,51 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{pkgs, ...}: { + home-manager.users.soispha.programs.nixvim = { + plugins.lsp.servers = { + ltex = let + filetypes = [ + "java" + "cpp" + "shell" + "bash" + + "bibtex" + "context" + "context.tex" + "latex" + "tex" + + "markdown" + "org" + "restructuredtext" + "rsweave" + + "git-commit" + "gitcommit" + + "mail" + ]; + in { + enable = true; + package = pkgs.ltex-ls-plus; + inherit filetypes; + settings = { + enabled = filetypes; + completionEnabled = false; + language = "en-CA"; + additionalRules = { + enablePickyRules = true; + }; + }; + }; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix deleted file mode 100644 index 9350cd37..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix +++ /dev/null @@ -1,25 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.lsp.servers = { - lua_ls = { - enable = true; - settings.telemetry.enable = false; - }; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls/default.nix new file mode 100644 index 00000000..ddd7609a --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls/default.nix @@ -0,0 +1,19 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + home-manager.users.soispha.programs.nixvim = { + plugins.lsp.servers = { + lua_ls = { + enable = true; + settings.telemetry.enable = false; + }; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix deleted file mode 100644 index 3b7e2523..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix +++ /dev/null @@ -1,27 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.lsp.servers = { - nil_ls = { - enable = true; - settings = { - formatting.command = ["alejandra"]; - }; - }; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls/default.nix new file mode 100644 index 00000000..6c4eef96 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls/default.nix @@ -0,0 +1,21 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + home-manager.users.soispha.programs.nixvim = { + plugins.lsp.servers = { + nil_ls = { + enable = true; + settings = { + formatting.command = ["alejandra"]; + }; + }; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix deleted file mode 100644 index 1d516c9d..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix +++ /dev/null @@ -1,48 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - extraConfigLuaPost = - /* - lua - */ - '' - vim.lsp.config['openscad_lsp'] = { - cmd = {"openscad-lsp", "--stdio", "--fmt-style", "WebKit"}, - } - vim.lsp.enable("openscad_lsp") - ''; - - autoCmd = [ - { - command = "set filetype=openscad"; - event = [ - "BufRead" - "BufNewFile" - ]; - pattern = [ - "*.scad" - ]; - } - ]; - - extraPackages = [ - pkgs.openscad-lsp - pkgs.clang-tools # Need to satisfy `clang-format` (which is used by openscad-lsp) - ]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad/default.nix new file mode 100644 index 00000000..4e4353bc --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad/default.nix @@ -0,0 +1,41 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{pkgs, ...}: { + home-manager.users.soispha.programs.nixvim = { + extraConfigLuaPost = + /* + lua + */ + '' + vim.lsp.config['openscad_lsp'] = { + cmd = {"openscad-lsp", "--stdio", "--fmt-style", "WebKit"}, + } + vim.lsp.enable("openscad_lsp") + ''; + + autoCmd = [ + { + command = "set filetype=openscad"; + event = [ + "BufRead" + "BufNewFile" + ]; + pattern = [ + "*.scad" + ]; + } + ]; + + extraPackages = [ + pkgs.openscad-lsp + pkgs.clang-tools # Need to satisfy `clang-format` (which is used by openscad-lsp) + ]; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix deleted file mode 100644 index 097abfbe..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix +++ /dev/null @@ -1,31 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - extraConfigLuaPost = - /* - lua - */ - '' - vim.lsp.enable('quick_lint_js') - ''; - - extraPackages = [ - pkgs.quick-lint-js - ]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js/default.nix new file mode 100644 index 00000000..edc0b10a --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js/default.nix @@ -0,0 +1,24 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{pkgs, ...}: { + home-manager.users.soispha.programs.nixvim = { + extraConfigLuaPost = + /* + lua + */ + '' + vim.lsp.enable('quick_lint_js') + ''; + + extraPackages = [ + pkgs.quick-lint-js + ]; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix deleted file mode 100644 index 3ad3ad8f..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix +++ /dev/null @@ -1,26 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.lsp.servers = { - ruff = { - enable = true; - }; - }; - extraPackages = [pkgs.ruff]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp/default.nix new file mode 100644 index 00000000..da30be2f --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp/default.nix @@ -0,0 +1,19 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{pkgs, ...}: { + home-manager.users.soispha.programs.nixvim = { + plugins.lsp.servers = { + ruff = { + enable = true; + }; + }; + extraPackages = [pkgs.ruff]; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix deleted file mode 100644 index fd344c50..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix +++ /dev/null @@ -1,34 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.lsp.servers = { - rust_analyzer = { - enable = true; - settings = { - typing.autoClosingAngleBrackets.enable = true; - - # Check with `cargo clippy` instead of just `cargo check` - check.command = "clippy"; - }; - # NOTE: These should be provided by the devenv, to support nightly and - # such things <2023-11-25> - installCargo = false; - installRustc = false; - }; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer/default.nix new file mode 100644 index 00000000..cf58653b --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer/default.nix @@ -0,0 +1,28 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + home-manager.users.soispha.programs.nixvim = { + plugins.lsp.servers = { + rust_analyzer = { + enable = true; + settings = { + typing.autoClosingAngleBrackets.enable = true; + + # Check with `cargo clippy` instead of just `cargo check` + check.command = "clippy"; + }; + # NOTE: These should be provided by the devenv, to support nightly and + # such things <2023-11-25> + installCargo = false; + installRustc = false; + }; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix deleted file mode 100644 index 5f001177..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix +++ /dev/null @@ -1,24 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.lsp.servers = { - texlab = { - enable = true; - }; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab/default.nix new file mode 100644 index 00000000..3181c77d --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab/default.nix @@ -0,0 +1,18 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + home-manager.users.soispha.programs.nixvim = { + plugins.lsp.servers = { + texlab = { + enable = true; + }; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls.nix deleted file mode 100644 index aab7a135..00000000 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls.nix +++ /dev/null @@ -1,30 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - extraConfigLuaPost = - /* - lua - */ - '' - vim.lsp.enable("zls") - ''; - extraPackages = [ - pkgs.zls - ]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls/default.nix new file mode 100644 index 00000000..cb2353b1 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/zls/default.nix @@ -0,0 +1,23 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{pkgs, ...}: { + home-manager.users.soispha.programs.nixvim = { + extraConfigLuaPost = + /* + lua + */ + '' + vim.lsp.enable("zls") + ''; + extraPackages = [ + pkgs.zls + ]; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/lspkind/default.nix b/modules/by-name/nv/nvim/plgs/lspkind/default.nix index 3846fa32..1b78d4ff 100644 --- a/modules/by-name/nv/nvim/plgs/lspkind/default.nix +++ b/modules/by-name/nv/nvim/plgs/lspkind/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim.plugins.lspkind = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim.plugins.lspkind = { enable = true; settings.preset = "default"; # "codicons" is only for a font patched with vscode-codeicons. }; diff --git a/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix b/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix index a01d5653..66ce7b96 100644 --- a/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix +++ b/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix @@ -7,15 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +{pkgs, ...}: { + home-manager.users.soispha.programs.nixvim = { # TODO: package ltex_extra though a module extraPlugins = [ pkgs.vimPlugins.ltex_extra-nvim diff --git a/modules/by-name/nv/nvim/plgs/lualine/default.nix b/modules/by-name/nv/nvim/plgs/lualine/default.nix index 7a69519b..c42181de 100644 --- a/modules/by-name/nv/nvim/plgs/lualine/default.nix +++ b/modules/by-name/nv/nvim/plgs/lualine/default.nix @@ -7,131 +7,124 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim.plugins.lualine = let - get_location_of_file = { - __raw = '' - function() - local file_lines = vim.fn.line('$'); - local file_current_cursor_positon = vim.fn.getcurpos(); - return file_current_cursor_positon[3] .. ":" .. file_current_cursor_positon[2] .. "/" .. file_lines - end - ''; - }; +{...}: let + get_location_of_file = { + __raw = '' + function() + local file_lines = vim.fn.line('$'); + local file_current_cursor_positon = vim.fn.getcurpos(); + return file_current_cursor_positon[3] .. ":" .. file_current_cursor_positon[2] .. "/" .. file_lines + end + ''; + }; - get_trailing_whitespace = { - __raw = '' + get_trailing_whitespace = { + __raw = '' + function() + local space = vim.fn.search([[\s\+$]], 'nwc') + return space ~= 0 and "TW:" .. space or "" + end + ''; + }; + get_mixed_indent = { + __raw = + /* + lua + */ + '' function() - local space = vim.fn.search([[\s\+$]], 'nwc') - return space ~= 0 and "TW:" .. space or "" + local space_pat = [[\v^ +]] + local tab_pat = [[\v^\t+]] + local space_indent = vim.fn.search(space_pat, 'nwc') + local tab_indent = vim.fn.search(tab_pat, 'nwc') + local mixed = (space_indent > 0 and tab_indent > 0) + local mixed_same_line + if not mixed then + mixed_same_line = vim.fn.search([[\v^(\t+ | +\t)]], 'nwc') + mixed = mixed_same_line > 0 + end + if not mixed then return "" end + if mixed_same_line ~= nil and mixed_same_line > 0 then + return 'MI:' .. mixed_same_line + end + local space_indent_cnt = vim.fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total + local tab_indent_cnt = vim.fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total + if space_indent_cnt > tab_indent_cnt then + return 'MI:' .. tab_indent + else + return 'MI:' .. space_indent + end end ''; - }; - get_mixed_indent = { - __raw = - /* - lua - */ - '' - function() - local space_pat = [[\v^ +]] - local tab_pat = [[\v^\t+]] - local space_indent = vim.fn.search(space_pat, 'nwc') - local tab_indent = vim.fn.search(tab_pat, 'nwc') - local mixed = (space_indent > 0 and tab_indent > 0) - local mixed_same_line - if not mixed then - mixed_same_line = vim.fn.search([[\v^(\t+ | +\t)]], 'nwc') - mixed = mixed_same_line > 0 - end - if not mixed then return "" end - if mixed_same_line ~= nil and mixed_same_line > 0 then - return 'MI:' .. mixed_same_line - end - local space_indent_cnt = vim.fn.searchcount({ pattern = space_pat, max_count = 1e3 }).total - local tab_indent_cnt = vim.fn.searchcount({ pattern = tab_pat, max_count = 1e3 }).total - if space_indent_cnt > tab_indent_cnt then - return 'MI:' .. tab_indent - else - return 'MI:' .. space_indent - end - end - ''; - }; - in - lib.mkIf cfg.enable { - enable = true; + }; +in { + home-manager.users.soispha.programs.nixvim.plugins.lualine = { + enable = true; - settings = { - options = { - iconsEnabled = true; - theme = "nightfox"; - }; + settings = { + options = { + iconsEnabled = true; + theme = "nightfox"; + }; - # TODO: add all installed and supported extensions here - extensions = [ - "toggleterm" - #"fugitive" # TODO: maybe add this? - ]; + # TODO: add all installed and supported extensions here + extensions = [ + "toggleterm" + #"fugitive" # TODO: maybe add this? + ]; - componentSeparators = { - left = ""; - right = ""; - }; - sectionSeparators = { - left = ""; - right = ""; - }; - disabledFiletypes = { - statusline = []; - winbar = []; - }; - ignoreFocus = []; - alwaysDivideMiddle = true; - globalstatus = false; - refresh = { - statusline = 1000; - tabline = 1000; - winbar = 1000; - }; - sections = { - lualine_a = ["mode"]; - lualine_b = [ - { - __raw = '' - {'FugitiveHead', icon = ""} - ''; - } - "diff" - "diagnostics" - ]; - lualine_c = ["filename"]; - lualine_x = ["searchcount" "filetype"]; - lualine_y = [ - "encoding" - "fileformat" - get_mixed_indent - get_trailing_whitespace - ]; - lualine_z = [get_location_of_file]; - }; - inactiveSections = { - lualine_a = []; - lualine_b = []; - lualine_c = ["filename"]; - lualine_x = [get_location_of_file]; - lualine_y = []; - lualine_z = []; - }; - tabline = {}; - winbar = {}; - inactiveWinbar = {}; + componentSeparators = { + left = ""; + right = ""; + }; + sectionSeparators = { + left = ""; + right = ""; + }; + disabledFiletypes = { + statusline = []; + winbar = []; + }; + ignoreFocus = []; + alwaysDivideMiddle = true; + globalstatus = false; + refresh = { + statusline = 1000; + tabline = 1000; + winbar = 1000; + }; + sections = { + lualine_a = ["mode"]; + lualine_b = [ + { + __raw = '' + {'FugitiveHead', icon = ""} + ''; + } + "diff" + "diagnostics" + ]; + lualine_c = ["filename"]; + lualine_x = ["searchcount" "filetype"]; + lualine_y = [ + "encoding" + "fileformat" + get_mixed_indent + get_trailing_whitespace + ]; + lualine_z = [get_location_of_file]; + }; + inactiveSections = { + lualine_a = []; + lualine_b = []; + lualine_c = ["filename"]; + lualine_x = [get_location_of_file]; + lualine_y = []; + lualine_z = []; }; + tabline = {}; + winbar = {}; + inactiveWinbar = {}; }; + }; } diff --git a/modules/by-name/nv/nvim/plgs/luasnip/default.nix b/modules/by-name/nv/nvim/plgs/luasnip/default.nix index 222b5070..b40743d6 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/default.nix +++ b/modules/by-name/nv/nvim/plgs/luasnip/default.nix @@ -7,15 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - lib, - config, - pkgs, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +{pkgs, ...}: { + home-manager.users.soispha.programs.nixvim = { keymaps = [ { key = ""; diff --git a/modules/by-name/nv/nvim/plgs/neorg/default.nix b/modules/by-name/nv/nvim/plgs/neorg/default.nix index b69f5a58..ac5e5a6a 100644 --- a/modules/by-name/nv/nvim/plgs/neorg/default.nix +++ b/modules/by-name/nv/nvim/plgs/neorg/default.nix @@ -7,13 +7,7 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { +{lib, ...}: { # TODO: Re-active, whence neorg actually builds with all the treesitter grammars # activated <2026-01-18> home-manager.users.soispha.programs.nixvim = lib.mkIf false { diff --git a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix index 48883bd3..9d6a4f6b 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix +++ b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix @@ -7,20 +7,14 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { +{...}: { soispha.nixpkgs.unfreePackageNames = [ # the plugin is lacking an license and is thus unfree, effectively # its okay though (TODO: investigate <2026-05-11>)? "cmp-calc" ]; - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + home-manager.users.soispha.programs.nixvim = { opts.completeopt = [ "menu" # Show completions in a menu "menuone" # Also open menu, when only one completion exists diff --git a/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix b/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix index 90e81832..9536f1a2 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix +++ b/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix @@ -9,13 +9,10 @@ # If not, see . { pkgs, - config, lib, ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +}: { + home-manager.users.soispha.programs.nixvim = { # TODO: package nvim-lint though a module extraConfigLuaPost = '' ${lib.strings.fileContents ./lua/nvim-lint.lua} diff --git a/modules/by-name/nv/nvim/plgs/telescope/default.nix b/modules/by-name/nv/nvim/plgs/telescope/default.nix index b2c66edc..b33dbe14 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/default.nix @@ -8,25 +8,29 @@ # You should have received a copy of the License along with this program. # If not, see . { - config, lib, + extra_lib, + pkgs, ... }: let - cfg = config.soispha.programs.nvim; -in { - imports = [ - ./defaults - ./keymaps - ./extensions - ]; - home-manager.users.soispha.programs.nixvim.plugins = lib.mkIf cfg.enable { - telescope = { - enable = true; - }; + defaults = import ./defaults {}; + keymaps = import ./keymaps {}; + extensions = import ./extensions {inherit extra_lib pkgs lib;}; +in + lib.mkMerge [ + defaults + keymaps + extensions + { + home-manager.users.soispha.programs.nixvim.plugins = { + telescope = { + enable = true; + }; - # This is a dependency of telescope - web-devicons = { - enable = true; - }; - }; -} + # This is a dependency of telescope + web-devicons = { + enable = true; + }; + }; + } + ] diff --git a/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix b/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix index 7cfe9698..8fb4a99d 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim.plugins.telescope.settings.defaults = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim.plugins.telescope.settings.defaults = { mappings = let insert_and_normal_mappings = { # map actions.which_key to (default: ) diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix deleted file mode 100644 index 693db974..00000000 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{config, ...}: let - cfg = config.soispha.programs.nvim; -in { - # TODO: Re-enable this, once the plugin is merged into nixpkgs <2025-03-29> - # home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - # extraPlugins = [ - # pkgs.vimExtraPlugins.telescope-bibtex-nvim - # ]; - # - # # Only activate this in tex files. - # extraFiles = { - # "ftplugin/tex.lua".text = '' - # ${lib.strings.fileContents ./tex.lua} - # ''; - # }; - # - # keymaps = [ - # { - # key = "ib"; - # # This is registered in the ftplugin file, so we set this to null here - # action = ""; - # mode = "n"; - # options.desc = "[i]nsert a [b]atex citation"; - # } - # ]; - # }; -} diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua deleted file mode 100644 index fbe7c993..00000000 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua +++ /dev/null @@ -1,70 +0,0 @@ --- nixos-config - My current NixOS configuration --- --- Copyright (C) 2025 Benedikt Peetz --- SPDX-License-Identifier: GPL-3.0-or-later --- --- This file is part of my nixos-config. --- --- You should have received a copy of the License along with this program. --- If not, see . - --- local used = false; --- vim.keymap.set('n', 't', function() --- used = not used; --- if used then --- require('nvim-treesitter.configs').setup { --- highlight = { --- additional_vim_regex_highlighting = { "latex", "markdown" }, --- }, --- } --- else --- require('nvim-treesitter.configs').setup { --- highlight = { --- additional_vim_regex_highlighting = { "" }, --- }, --- } --- end --- end --- ); --- --- - --- Set tex specific telescope extension -require("telescope").setup({ - extensions = { - bibtex = { - -- Depth for the *.bib file - depth = 1, - -- Path to global bibliographies (placed outside of the project) - global_files = {}, - -- Define the search keys to use in the picker - search_keys = { "author", "year", "title" }, - -- Template for the formatted citation - citation_format = "{{author}} ({{year}}), {{title}}.", - -- Only use initials for the authors first name - citation_trim_firstname = true, - -- Max number of authors to write in the formatted citation - -- following authors will be replaced by "et al." - citation_max_auth = 2, - -- Wrapping in the preview window is disabled by default - wrap = false, - -- Custom format for citation label - custom_formats = { - { id = "tex_autocite", cite_marker = "\\autocite{%s}" }, - }, - format = "tex_autocite", - -- Use context awareness - context = true, - -- Fallback to global/directory .bib files if context not found - -- This setting has no effect if context = false - context_fallback = true, - }, - }, -}) -require("telescope").load_extension("bibtex") -vim.keymap.set( - "n", - "ib", - function() require("telescope").extensions.bibtex.bibtex() end, - { noremap = true, silent = true, desc = "list bibtex entries in telescope" } -) diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix index 0b0ed0f6..3fc3aefc 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix @@ -7,12 +7,17 @@ # # You should have received a copy of the License along with this program. # If not, see . -{...}: { - imports = [ - ./bibtex - ./frecency - ./fzy-native - ./rooter - ./symbols - ]; -} +{ + extra_lib, + lib, + pkgs, + ... +}: let + extensions = builtins.attrValues (extra_lib.mkByName { + useShards = false; + baseDirectory = ./ext; + fileName = "default.nix"; + finalizeFunction = name: path: import path {inherit pkgs lib;}; + }); +in + lib.mkMerge extensions diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/bibtex/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/bibtex/default.nix new file mode 100644 index 00000000..c2fea575 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/bibtex/default.nix @@ -0,0 +1,34 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + # TODO: Re-enable this, once the plugin is merged into nixpkgs <2025-03-29> + # home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + # extraPlugins = [ + # pkgs.vimExtraPlugins.telescope-bibtex-nvim + # ]; + # + # # Only activate this in tex files. + # extraFiles = { + # "ftplugin/tex.lua".text = '' + # ${lib.strings.fileContents ./tex.lua} + # ''; + # }; + # + # keymaps = [ + # { + # key = "ib"; + # # This is registered in the ftplugin file, so we set this to null here + # action = ""; + # mode = "n"; + # options.desc = "[i]nsert a [b]atex citation"; + # } + # ]; + # }; +} diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/bibtex/tex.lua b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/bibtex/tex.lua new file mode 100644 index 00000000..fbe7c993 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/bibtex/tex.lua @@ -0,0 +1,70 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see . + +-- local used = false; +-- vim.keymap.set('n', 't', function() +-- used = not used; +-- if used then +-- require('nvim-treesitter.configs').setup { +-- highlight = { +-- additional_vim_regex_highlighting = { "latex", "markdown" }, +-- }, +-- } +-- else +-- require('nvim-treesitter.configs').setup { +-- highlight = { +-- additional_vim_regex_highlighting = { "" }, +-- }, +-- } +-- end +-- end +-- ); +-- +-- + +-- Set tex specific telescope extension +require("telescope").setup({ + extensions = { + bibtex = { + -- Depth for the *.bib file + depth = 1, + -- Path to global bibliographies (placed outside of the project) + global_files = {}, + -- Define the search keys to use in the picker + search_keys = { "author", "year", "title" }, + -- Template for the formatted citation + citation_format = "{{author}} ({{year}}), {{title}}.", + -- Only use initials for the authors first name + citation_trim_firstname = true, + -- Max number of authors to write in the formatted citation + -- following authors will be replaced by "et al." + citation_max_auth = 2, + -- Wrapping in the preview window is disabled by default + wrap = false, + -- Custom format for citation label + custom_formats = { + { id = "tex_autocite", cite_marker = "\\autocite{%s}" }, + }, + format = "tex_autocite", + -- Use context awareness + context = true, + -- Fallback to global/directory .bib files if context not found + -- This setting has no effect if context = false + context_fallback = true, + }, + }, +}) +require("telescope").load_extension("bibtex") +vim.keymap.set( + "n", + "ib", + function() require("telescope").extensions.bibtex.bibtex() end, + { noremap = true, silent = true, desc = "list bibtex entries in telescope" } +) diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/frecency/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/frecency/default.nix new file mode 100644 index 00000000..83a4ed3d --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/frecency/default.nix @@ -0,0 +1,31 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + home-manager.users.soispha.programs.nixvim = { + keymaps = [ + { + key = "gff"; + mode = "n"; + action.__raw = "function() require('telescope').extensions.frecency.frecency() end"; + options.desc = "activate the frecency file selection"; + } + ]; + plugins.telescope = { + extensions.frecency = { + enable = true; + settings = { + show_scores = true; + db_safe_mode = false; + default_workspace = "CWD"; # or 'LSP' + }; + }; + }; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/fzy-native/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/fzy-native/default.nix new file mode 100644 index 00000000..1b173516 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/fzy-native/default.nix @@ -0,0 +1,14 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{...}: { + home-manager.users.soispha.programs.nixvim.plugins.telescope.extensions.fzy-native = { + enable = true; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/rooter/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/rooter/default.nix new file mode 100644 index 00000000..de1aa929 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/rooter/default.nix @@ -0,0 +1,16 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see . +{lib, ...}: { + home-manager.users.soispha.programs.nixvim = { + extraConfigLuaPost = '' + ${lib.strings.fileContents ./lua/rooter.lua} + ''; + }; +} diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/rooter/lua/rooter.lua b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/rooter/lua/rooter.lua new file mode 100644 index 00000000..b6542429 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/ext/rooter/lua/rooter.lua @@ -0,0 +1,86 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see . + +-- Taken from: https://github.com/desdic/telescope-rooter.nvim/blob/69423216c75a5f1f1477bbf8faf6b0dc8af04099/lua/telescope/_extensions/rooter.lua +local has_telescope, telescope = pcall(require, "telescope") +if not has_telescope then + error("This extension requires telescope.nvim") + return +end + +local has_plenary, plenary = pcall(require, "plenary") +if not has_plenary then + error("This extension requires plenary") + return +end + +local log = plenary.log.new({ plugin = "telescope_rooter", level = "info" }) + +-- TODO: expose this function +local toggle = function(_) + vim.g["Telescope#rooter#enabled"] = not vim.g["Telescope#rooter#enabled"] + print("Telescope#rooter#enabled=" .. vim.inspect(vim.g["Telescope#rooter#enabled"])) +end + +local config = { patterns = { ".git" }, enable = true, debug = false } + +-- default enabled +vim.g["Telescope#rooter#enabled"] = vim.F.if_nil(config.enable, true) + +-- redefine log if debug enabled +if vim.F.if_nil(config.debug, false) then log = plenary.log.new({ plugin = "telescope_rooter", level = "debug" }) end + +local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true }) + +vim.api.nvim_create_autocmd({ "DirChangedPre" }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then return end + + if vim.g["Telescope#rooter#oldpwd"] == nil then + vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() + log.debug("before " .. vim.inspect(vim.loop.cwd())) + end + end, + group = group, +}) + +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then return end + + vim.schedule(function() + if vim.bo.filetype == "TelescopePrompt" then + local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true })[1]) + if rootdir ~= nil then + vim.api.nvim_set_current_dir(rootdir) + log.debug("changing dir to " .. rootdir) + end + end + end) + end, + group = group, +}) + +vim.api.nvim_create_autocmd({ "BufWinLeave" }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then return end + + vim.schedule(function() + if vim.bo.filetype ~= "TelescopePrompt" then + if vim.g["Telescope#rooter#oldpwd"] ~= nil then + log.debug("restoring " .. vim.g["Telescope#rooter#oldpwd"]) + vim.api.nvim_set_current_dir(vim.g["Telescope#rooter#oldpwd"]) + vim.g["Telescope#rooter#oldpwd"] = nil + end + end + end) + end, + group = group, +}) diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix deleted file mode 100644 index 3d5eae99..00000000 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - lib, - config, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - keymaps = [ - { - key = "gff"; - mode = "n"; - action.__raw = "function() require('telescope').extensions.frecency.frecency() end"; - options.desc = "activate the frecency file selection"; - } - ]; - plugins.telescope = { - extensions.frecency = { - enable = true; - settings = { - show_scores = true; - db_safe_mode = false; - default_workspace = "CWD"; # or 'LSP' - }; - }; - }; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix deleted file mode 100644 index 7a2fc164..00000000 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim.plugins.telescope.extensions.fzy-native = lib.mkIf cfg.enable { - enable = true; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix deleted file mode 100644 index 4d91e988..00000000 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - lib, - config, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - extraConfigLuaPost = '' - ${lib.strings.fileContents ./lua/rooter.lua} - ''; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua deleted file mode 100644 index b6542429..00000000 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua +++ /dev/null @@ -1,86 +0,0 @@ --- nixos-config - My current NixOS configuration --- --- Copyright (C) 2025 Benedikt Peetz --- SPDX-License-Identifier: GPL-3.0-or-later --- --- This file is part of my nixos-config. --- --- You should have received a copy of the License along with this program. --- If not, see . - --- Taken from: https://github.com/desdic/telescope-rooter.nvim/blob/69423216c75a5f1f1477bbf8faf6b0dc8af04099/lua/telescope/_extensions/rooter.lua -local has_telescope, telescope = pcall(require, "telescope") -if not has_telescope then - error("This extension requires telescope.nvim") - return -end - -local has_plenary, plenary = pcall(require, "plenary") -if not has_plenary then - error("This extension requires plenary") - return -end - -local log = plenary.log.new({ plugin = "telescope_rooter", level = "info" }) - --- TODO: expose this function -local toggle = function(_) - vim.g["Telescope#rooter#enabled"] = not vim.g["Telescope#rooter#enabled"] - print("Telescope#rooter#enabled=" .. vim.inspect(vim.g["Telescope#rooter#enabled"])) -end - -local config = { patterns = { ".git" }, enable = true, debug = false } - --- default enabled -vim.g["Telescope#rooter#enabled"] = vim.F.if_nil(config.enable, true) - --- redefine log if debug enabled -if vim.F.if_nil(config.debug, false) then log = plenary.log.new({ plugin = "telescope_rooter", level = "debug" }) end - -local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true }) - -vim.api.nvim_create_autocmd({ "DirChangedPre" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end - - if vim.g["Telescope#rooter#oldpwd"] == nil then - vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() - log.debug("before " .. vim.inspect(vim.loop.cwd())) - end - end, - group = group, -}) - -vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end - - vim.schedule(function() - if vim.bo.filetype == "TelescopePrompt" then - local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true })[1]) - if rootdir ~= nil then - vim.api.nvim_set_current_dir(rootdir) - log.debug("changing dir to " .. rootdir) - end - end - end) - end, - group = group, -}) - -vim.api.nvim_create_autocmd({ "BufWinLeave" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end - - vim.schedule(function() - if vim.bo.filetype ~= "TelescopePrompt" then - if vim.g["Telescope#rooter#oldpwd"] ~= nil then - log.debug("restoring " .. vim.g["Telescope#rooter#oldpwd"]) - vim.api.nvim_set_current_dir(vim.g["Telescope#rooter#oldpwd"]) - vim.g["Telescope#rooter#oldpwd"] = nil - end - end - end) - end, - group = group, -}) diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix deleted file mode 100644 index 1f82523d..00000000 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix +++ /dev/null @@ -1,68 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see . -{ - pkgs, - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - extraPlugins = [ - # Source of symbols for telescope symbols - pkgs.vimPlugins.telescope-symbols-nvim - ]; - keymaps = [ - { - key = "il"; - mode = "n"; - action.__raw = '' - function() - require('telescope.builtin').symbols{ sources = { - 'latex' - }} - end - ''; - options.desc = "[i]nsert a [l]atex symbol"; - } - { - key = "ie"; - mode = "n"; - action.__raw = '' - function() - require('telescope.builtin').symbols{ sources = { - 'emoji', - }} - end - ''; - options.desc = "[i]nsert a [e]moji"; - } - { - key = "is"; - mode = "n"; - action.__raw = '' - function() - require('telescope.builtin').symbols{ sources = { - 'emoji', - 'gitmoji', - 'julia', - 'kaomoji', - 'latex', - 'math', - 'nerd', - }} - end - ''; - options.desc = "[i]nsert a [s]ymbol (like emojis)"; - } - ]; - }; -} diff --git a/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix b/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix index d5cc55f5..12c56887 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim.plugins.telescope.keymaps = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim.plugins.telescope.keymaps = { "rg" = { action = "live_grep"; options = { diff --git a/modules/by-name/nv/nvim/plgs/todo-comments/default.nix b/modules/by-name/nv/nvim/plgs/todo-comments/default.nix index cd1a7dbf..a535469c 100644 --- a/modules/by-name/nv/nvim/plgs/todo-comments/default.nix +++ b/modules/by-name/nv/nvim/plgs/todo-comments/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim.plugins.todo-comments = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim.plugins.todo-comments = { enable = true; settings = { guiStyle = { diff --git a/modules/by-name/nv/nvim/plgs/treesitter/default.nix b/modules/by-name/nv/nvim/plgs/treesitter/default.nix index 1377cb8a..acce3e6e 100644 --- a/modules/by-name/nv/nvim/plgs/treesitter/default.nix +++ b/modules/by-name/nv/nvim/plgs/treesitter/default.nix @@ -8,14 +8,11 @@ # You should have received a copy of the License along with this program. # If not, see . { - config, pkgs, lib, ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { +}: { + home-manager.users.soispha.programs.nixvim = { # NOTE: These are required to build grammars, but I already use the nix grammars <2024-07-13> dependencies = { tree-sitter.enable = false; diff --git a/modules/by-name/nv/nvim/plgs/vim-tex/default.nix b/modules/by-name/nv/nvim/plgs/vim-tex/default.nix index 71422f94..7538540c 100644 --- a/modules/by-name/nv/nvim/plgs/vim-tex/default.nix +++ b/modules/by-name/nv/nvim/plgs/vim-tex/default.nix @@ -7,13 +7,7 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { +{lib, ...}: { # TODO: Do I still need this module at all? <2026-01-18> home-manager.users.soispha.programs.nixvim = lib.mkIf false { opts.conceallevel = 0; diff --git a/modules/by-name/nv/nvim/plgs/which-key/default.nix b/modules/by-name/nv/nvim/plgs/which-key/default.nix index e5bca546..b247b533 100644 --- a/modules/by-name/nv/nvim/plgs/which-key/default.nix +++ b/modules/by-name/nv/nvim/plgs/which-key/default.nix @@ -7,14 +7,8 @@ # # You should have received a copy of the License along with this program. # If not, see . -{ - config, - lib, - ... -}: let - cfg = config.soispha.programs.nvim; -in { - home-manager.users.soispha.programs.nixvim.plugins.which-key = lib.mkIf cfg.enable { +{...}: { + home-manager.users.soispha.programs.nixvim.plugins.which-key = { enable = true; }; } -- cgit v1.3.1