diff options
| author | seth <[email protected]> | 2024-10-29 23:05:02 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-30 03:05:02 +0000 |
| commit | 2e766b185d2bb6fa38c0bd8fb980ba8fffeedb3a (patch) | |
| tree | 7c4bc93efe19c00f58bf4df2447b4677488d70ad /wrapper.nix | |
| parent | 310fdf8de53d98ddd3a56936c131186e25814f0f (diff) | |
use custom wrapper (#70)
* use custom wrapper
* flake: use nix-filter on self
* don't load remote plugins
* use nvim-cmp and fidget from luarocks
Diffstat (limited to 'wrapper.nix')
| -rw-r--r-- | wrapper.nix | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/wrapper.nix b/wrapper.nix new file mode 100644 index 0000000..1127e61 --- /dev/null +++ b/wrapper.nix @@ -0,0 +1,66 @@ +{ + lib, + emptyFile, + lua, + makeBinaryWrapper, + neovim-unwrapped, + neovimUtils, + runCommand, + writeText, +}: +{ + pname ? lib.removeSuffix "-unwrapped" neovim-unwrapped.pname, + version ? neovim-unwrapped.version, + name ? "${pname}-${version}", + makeWrapperArgs ? [ ], + luaPluginPackages ? _: [ ], + vimPluginPackages ? [ ], + runtimePrograms ? [ ], + luaRc ? emptyFile, + ... +}: + +let + luaEnv = lua.withPackages luaPluginPackages; + + normalizedPlugins = neovimUtils.normalizePlugins vimPluginPackages; + neovimPackage = neovimUtils.normalizedPluginsToVimPackage normalizedPlugins; + packDir = neovimUtils.packDir { inherit neovimPackage; }; + + vendorRc = writeText "vendor.vim" '' + lua package.path = "${luaEnv.luaPath}"; package.cpath = "${luaEnv.luaCpath}" + set packpath^=${packDir} | set runtimepath^=${packDir} + luafile ${luaRc} + ''; + + flags = [ + "-u" + (toString vendorRc) + ]; +in +runCommand name + { + __structuredAttrs = true; + + nativeBuildInputs = [ makeBinaryWrapper ]; + + makeWrapperArgs = makeWrapperArgs ++ [ + "--add-flags" + (lib.escapeShellArgs flags) + "--suffix" + "PATH" + ":" + (lib.makeBinPath runtimePrograms) + ]; + + passthru = { + inherit luaEnv; + }; + + meta = { + inherit (neovim-unwrapped.meta) description mainProgram; + }; + } + '' + makeWrapper ${lib.getExe neovim-unwrapped} $out/bin/nvim "''${makeWrapperArgs[@]}" + '' |
