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}
This section lists the release notes for tagged version of **nvf** and the
current main current main branch
This section lists the release notes for tagged version of **nvf** and the current main branch
```{=include=} chapters
rl-0.1.md
@ -11,4 +10,5 @@ rl-0.4.md
rl-0.5.md
rl-0.6.md
rl-0.7.md
rl-0.8.md
```

View file

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

View file

@ -4,10 +4,27 @@
...
}: let
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;
in {
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 {
type = package;
default = pkgs.neovim-unwrapped;
@ -101,7 +118,7 @@ in {
extraPackages = mkOption {
type = listOf package;
default = [];
example = ''[pkgs.fzf pkgs.ripgrep]'';
example = "[pkgs.fzf pkgs.ripgrep]";
description = ''
List of additional packages to make available to the Neovim
wrapper.