wrapper/environment: add vim.appName to configure NVIM_APPNAME

This commit is contained in:
Gabriel Nützi 2026-06-13 12:39:28 +02:00
commit c0b6c55b19
No known key found for this signature in database
GPG key ID: 37A5F59C07097058
3 changed files with 50 additions and 21 deletions

View file

@ -1,7 +1,6 @@
# Release Notes {#ch-release-notes} # Release Notes {#ch-release-notes}
This section lists the release notes for tagged version of **nvf** and the This section lists the release notes for tagged version of **nvf** and the current main branch
current main current main branch
```{=include=} chapters ```{=include=} chapters
rl-0.1.md rl-0.1.md
@ -11,4 +10,5 @@ rl-0.4.md
rl-0.5.md rl-0.5.md
rl-0.6.md rl-0.6.md
rl-0.7.md rl-0.7.md
rl-0.8.md
``` ```

View file

@ -7,7 +7,13 @@
}: let }: let
inherit (pkgs) vimPlugins; inherit (pkgs) vimPlugins;
inherit (lib.trivial) flip; inherit (lib.trivial) flip;
inherit (builtins) filter isString hasAttr getAttr; inherit
(builtins)
filter
isString
hasAttr
getAttr
;
getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {}); getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {});
@ -52,21 +58,23 @@
}; };
buildConfigPlugins = plugins: buildConfigPlugins = plugins:
map (plug: map (
if (isString plug) plug:
then if (isString plug)
if hasAttr plug config.vim.pluginOverrides
then then
(let if hasAttr plug config.vim.pluginOverrides
plugin = config.vim.pluginOverrides.${plug}; then
in (
if (lib.isType "flake" plugin) let
then plugin // {name = plug;} plugin = config.vim.pluginOverrides.${plug};
else plugin) in
else pluginBuilders.${plug} or (noBuildPlug plug) if (lib.isType "flake" plugin)
else plug) ( then plugin // {name = plug;}
filter (f: f != null) plugins else plugin
); )
else pluginBuilders.${plug} or (noBuildPlug plug)
else plug
) (filter (f: f != null) plugins);
# Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to # Wrap the user's desired (unwrapped) Neovim package with arguments that'll be used to
# generate a wrapped Neovim package. # generate a wrapped Neovim package.
@ -76,7 +84,7 @@
start = buildConfigPlugins config.vim.startPlugins; start = buildConfigPlugins config.vim.startPlugins;
opt = buildConfigPlugins config.vim.optPlugins; opt = buildConfigPlugins config.vim.optPlugins;
}; };
appName = "nvf"; appName = config.vim.appName;
extraBinPath = config.vim.extraPackages; extraBinPath = config.vim.extraPackages;
initLua = config.vim.builtLuaConfigRC; initLua = config.vim.builtLuaConfigRC;
luaFiles = config.vim.extraLuaFiles; luaFiles = config.vim.extraLuaFiles;
@ -103,7 +111,11 @@
# or module consumption. # or module consumption.
neovim = pkgs.symlinkJoin { neovim = pkgs.symlinkJoin {
name = "nvf-with-helpers"; name = "nvf-with-helpers";
paths = [neovim-wrapped printConfig printConfigPath]; paths = [
neovim-wrapped
printConfig
printConfigPath
];
postBuild = "echo Helpers added"; postBuild = "echo Helpers added";
# Allow evaluating config.vim, i.e., config.vim from the packages' passthru # Allow evaluating config.vim, i.e., config.vim from the packages' passthru

View file

@ -4,10 +4,27 @@
... ...
}: let }: let
inherit (lib.options) mkOption mkEnableOption literalMD; inherit (lib.options) mkOption mkEnableOption literalMD;
inherit (lib.types) package bool str listOf attrsOf; inherit
(lib.types)
package
bool
str
listOf
attrsOf
;
inherit (lib.nvim.types) pluginsOpt extraPluginType; inherit (lib.nvim.types) pluginsOpt extraPluginType;
in { in {
options.vim = { options.vim = {
appName = mkOption {
type = str;
default = "nvf";
description = ''
The neovim application name corresponding to the
`NVIM_APPNAME`
[environment variable](https://neovim.io/doc/user/starting/#_nvim_appname).
'';
};
package = mkOption { package = mkOption {
type = package; type = package;
default = pkgs.neovim-unwrapped; default = pkgs.neovim-unwrapped;
@ -101,7 +118,7 @@ in {
extraPackages = mkOption { extraPackages = mkOption {
type = listOf package; type = listOf package;
default = []; default = [];
example = ''[pkgs.fzf pkgs.ripgrep]''; example = "[pkgs.fzf pkgs.ripgrep]";
description = '' description = ''
List of additional packages to make available to the Neovim List of additional packages to make available to the Neovim
wrapper. wrapper.