From 64f1504c4f8dfec178c18ea24b922a47355df083 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 3 Sep 2025 14:17:31 +0300 Subject: [PATCH 1/5] lib/languages: fix typo in server submodule Signed-off-by: NotAShelf Change-Id: I6a6a6964c495ef58a9572ae93715bacf694a6ff5 --- lib/languages.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/languages.nix b/lib/languages.nix index d66880a1..899d9ea8 100644 --- a/lib/languages.nix +++ b/lib/languages.nix @@ -46,7 +46,7 @@ in { capabilities = mkOption { type = nullOr (either luaInline (attrsOf anything)); default = null; - description = "LSP capabilitiess to pass to lspconfig"; + description = "LSP capabilities to pass to LSP server configuration"; }; on_attach = mkOption { @@ -58,7 +58,7 @@ in { filetypes = mkOption { type = nullOr (listOf str); default = null; - description = "Filetypes to auto-attach LSP in"; + description = "Filetypes to auto-attach LSP server in"; }; cmd = mkOption { From 8b98f07862ddbffbfc93bb7507ffae524fcfef5c Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 3 Sep 2025 14:44:46 +0300 Subject: [PATCH 2/5] wrapper/build: add option examples; put evaluated values in `literalExpression` Signed-off-by: NotAShelf Change-Id: I6a6a69648220a65886994d4cac67f634a61815d5 --- modules/wrapper/build/config.nix | 47 ++++++++++++++++++------- modules/wrapper/environment/options.nix | 22 ++++++------ 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/modules/wrapper/build/config.nix b/modules/wrapper/build/config.nix index a1807388..03c42787 100644 --- a/modules/wrapper/build/config.nix +++ b/modules/wrapper/build/config.nix @@ -22,9 +22,7 @@ passthru.vimPlugin = false; }; - # build a vim plugin with the given name and arguments - # if the plugin is nvim-treesitter, warn the user to use buildTreesitterPlug - # instead + # Build a Vim plugin with the given name and arguments. buildPlug = attrs: let pin = getPin attrs.pname; in @@ -36,6 +34,7 @@ // attrs ); + # Build a given Treesitter grammar. buildTreesitterPlug = grammars: vimPlugins.nvim-treesitter.withPlugins (_: grammars); pluginBuilders = { @@ -48,6 +47,9 @@ doCheck = false; }; + # Get plugins built from source from self.packages + # If adding a new plugin to be built from source, it must also be inherited + # here. inherit (inputs.self.packages.${pkgs.stdenv.system}) blink-cmp avante-nvim; }; @@ -71,29 +73,38 @@ # Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to # generate a wrapped Neovim package. neovim-wrapped = inputs.mnw.lib.wrap {inherit pkgs;} { + appName = "nvf"; neovim = config.vim.package; + initLua = config.vim.builtLuaConfigRC; + luaFiles = config.vim.extraLuaFiles; + + # Plugin configurations plugins = { start = buildConfigPlugins config.vim.startPlugins; opt = buildConfigPlugins config.vim.optPlugins; }; - appName = "nvf"; - extraBinPath = config.vim.extraPackages; - initLua = config.vim.builtLuaConfigRC; - luaFiles = config.vim.extraLuaFiles; + + # Providers for Neovim providers = { + ruby.enable = config.vim.withRuby; + nodeJs.enable = config.vim.withNodeJs; python3 = { enable = config.vim.withPython3; extraPackages = ps: map (flip builtins.getAttr ps) config.vim.python3Packages; }; - ruby.enable = config.vim.withRuby; - nodeJs.enable = config.vim.withNodeJs; }; + + # Aliases to link `nvim` to aliases = lib.optional config.vim.viAlias "vi" ++ lib.optional config.vim.vimAlias "vim"; + # Additional packages or Lua packages to be made available to Neovim + extraBinPath = config.vim.extraPackages; extraLuaPackages = ps: map (flip builtins.getAttr ps) config.vim.luaPackages; }; + # A store path representing the built Lua configuration. dummyInit = pkgs.writeText "nvf-init.lua" config.vim.builtLuaConfigRC; + # Additional helper scripts for printing and displaying nvf configuration # in your commandline. printConfig = pkgs.writers.writeDashBin "nvf-print-config" "cat ${dummyInit}"; @@ -106,10 +117,20 @@ paths = [neovim-wrapped printConfig printConfigPath]; postBuild = "echo Helpers added"; - # Allow evaluating config.vim, i.e., config.vim from the packages' passthru - # attribute. For example, packages.x86_64-linux.neovim.passthru.neovimConfig - # will return the configuration in full. - passthru.neovimConfig = config.vim; + passthru = { + # Allow evaluating config.vim, i.e., config.vim from the packages' passthru + # attribute. For example, packages.x86_64-linux.neovim.passthru.neovimConfig + # will return the configuration in full. + neovimConfig = config.vim; + + # Also expose the helper scripts in passthru. + nvfPrintConfig = printConfig; + nvfPrintConfigPath = printConfigPath; + + # In systems where we only have a package and no module, this can be used + # to access the built init.lua + initLua = dummyInit; + }; meta = neovim-wrapped.meta diff --git a/modules/wrapper/environment/options.nix b/modules/wrapper/environment/options.nix index c401f506..d3b28b0f 100644 --- a/modules/wrapper/environment/options.nix +++ b/modules/wrapper/environment/options.nix @@ -3,7 +3,7 @@ lib, ... }: let - inherit (lib.options) mkOption mkEnableOption literalMD; + inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; inherit (lib.types) package bool str listOf attrsOf; inherit (lib.nvim.types) pluginsOpt extraPluginType; in { @@ -11,6 +11,7 @@ in { package = mkOption { type = package; default = pkgs.neovim-unwrapped; + defaultText = literalExpression "pkgs.neovim-unwrapped"; description = '' The neovim package to use for the wrapper. This corresponds to the package that will be wrapped @@ -27,21 +28,20 @@ in { viAlias = mkOption { type = bool; default = true; + example = false; description = "Enable the `vi` alias for `nvim`"; }; vimAlias = mkOption { type = bool; default = true; + example = false; description = "Enable the `vim` alias for `nvim`"; }; startPlugins = pluginsOpt { default = ["plenary-nvim"]; - example = '' - [pkgs.vimPlugins.telescope-nvim] - ''; - + example = literalExpression "[pkgs.vimPlugins.telescope-nvim]"; description = '' List of plugins to load on startup. This is used internally to add plugins to Neovim's runtime. @@ -54,9 +54,7 @@ in { optPlugins = pluginsOpt { default = []; - example = '' - [pkgs.vimPlugins.vim-ghost] - ''; + example = literalExpression "[pkgs.vimPlugins.vim-ghost]"; description = '' List of plugins to optionally load on startup. @@ -108,7 +106,7 @@ in { ''; }; - # this defaults to `true` in the wrapper + # This defaults to `true` in the wrapper # and since we pass this value to the wrapper # with an inherit, it should be `true` here as well withRuby = @@ -120,14 +118,14 @@ in { }; withNodeJs = mkEnableOption '' - NodeJs support in the Neovim wrapper + NodeJS support in the Neovim wrapper ''; luaPackages = mkOption { type = listOf str; default = []; example = ''["magick" "serpent"]''; - description = "List of lua packages to install"; + description = "List of Lua packages to install"; }; withPython3 = mkEnableOption '' @@ -144,7 +142,7 @@ in { pluginOverrides = mkOption { type = attrsOf package; default = {}; - example = '' + example = literalExpression '' { lazydev-nvim = pkgs.fetchFromGitHub { owner = "folke"; From 09e7f44ba1c8497540ed97e88391349c88a123fd Mon Sep 17 00:00:00 2001 From: alfarel Date: Sat, 26 Jul 2025 22:58:37 -0400 Subject: [PATCH 3/5] languages/yaml: fix on_attach by using mkLuaInline --- modules/plugins/languages/yaml.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/plugins/languages/yaml.nix b/modules/plugins/languages/yaml.nix index 1869b1c1..8a74fa9d 100644 --- a/modules/plugins/languages/yaml.nix +++ b/modules/plugins/languages/yaml.nix @@ -5,6 +5,7 @@ ... }: let inherit (builtins) attrNames; + inherit (lib.generators) mkLuaInline; inherit (lib.options) mkEnableOption mkOption; inherit (lib.modules) mkIf mkMerge; inherit (lib.meta) getExe; @@ -14,16 +15,17 @@ cfg = config.vim.languages.yaml; - onAttach = - if config.vim.languages.helm.lsp.enable + on_attach = mkLuaInline ( + if config.vim.languages.helm.lsp.enable && config.vim.languages.helm.enable then '' - on_attach = function(client, bufnr) + function(client, bufnr) local filetype = vim.bo[bufnr].filetype if filetype == "helm" then client.stop() end end'' - else "on_attach = default_on_attach"; + else "default_on_attach" + ); defaultServers = ["yaml-language-server"]; servers = { @@ -32,7 +34,7 @@ cmd = [(getExe pkgs.yaml-language-server) "--stdio"]; filetypes = ["yaml" "yaml.docker-compose" "yaml.gitlab" "yaml.helm-values"]; root_markers = [".git"]; - on_attach = onAttach; + inherit on_attach; # -- https://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting settings = { redhat = { From 671b6d187b436060ef9dcecf38b9358e69f5f4bf Mon Sep 17 00:00:00 2001 From: alfarel Date: Sun, 27 Jul 2025 08:22:38 -0400 Subject: [PATCH 4/5] languages/helm: fix yaml-language-server integration --- docs/release-notes/rl-0.8.md | 2 ++ modules/plugins/languages/helm.nix | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 83839245..b738571b 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -289,6 +289,8 @@ - Fix [blink.cmp] breaking when built-in sources were modified. - Fix [conform.nvim] not allowing disabling formatting on and after save. Use `null` value to disable them if conform is enabled. +- Fix Helm-YAML language module integration. YAML diagnostics will now remain in + `helmfile`s when both are enabled. [TheColorman](https://github.com/TheColorman): diff --git a/modules/plugins/languages/helm.nix b/modules/plugins/languages/helm.nix index 1971eb31..450177ad 100644 --- a/modules/plugins/languages/helm.nix +++ b/modules/plugins/languages/helm.nix @@ -6,7 +6,7 @@ }: let inherit (builtins) attrNames head; inherit (lib.options) mkEnableOption mkOption; - inherit (lib.modules) mkIf mkMerge; + inherit (lib.modules) mkDefault mkIf mkMerge; inherit (lib.meta) getExe; inherit (lib.types) enum; inherit (lib.nvim.types) mkGrammarOption singleOrListOf; @@ -27,11 +27,13 @@ dynamicRegistration = true; }; }; - settings = { + settings = mkIf (yamlCfg.enable && yamlCfg.lsp.enable) { helm-ls = { yamlls = { - # TODO: Determine if this is a good enough solution - path = (head yamlCfg.lsp.servers).cmd; + # Without this being enabled, the YAML language module will look broken in helmfiles + # if both modules are enabled at once. + enabled = mkDefault yamlCfg.lsp.enable; + path = head config.vim.lsp.servers.${head yamlCfg.lsp.servers}.cmd; }; }; }; From 68ca28af796c9777d6fa99523bbb027902e76942 Mon Sep 17 00:00:00 2001 From: alfarel Date: Sat, 6 Sep 2025 16:43:59 +0000 Subject: [PATCH 5/5] language/yaml: call default_on_attach in helm version --- docs/release-notes/rl-0.8.md | 2 ++ modules/plugins/languages/yaml.nix | 1 + 2 files changed, 3 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index b738571b..d427188f 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -291,6 +291,8 @@ `null` value to disable them if conform is enabled. - Fix Helm-YAML language module integration. YAML diagnostics will now remain in `helmfile`s when both are enabled. +- Fix YAML language module not activating LSP keybinds if the Helm language + module was also enabled. [TheColorman](https://github.com/TheColorman): diff --git a/modules/plugins/languages/yaml.nix b/modules/plugins/languages/yaml.nix index 8a74fa9d..b06ef17f 100644 --- a/modules/plugins/languages/yaml.nix +++ b/modules/plugins/languages/yaml.nix @@ -19,6 +19,7 @@ if config.vim.languages.helm.lsp.enable && config.vim.languages.helm.enable then '' function(client, bufnr) + default_on_attach() local filetype = vim.bo[bufnr].filetype if filetype == "helm" then client.stop()