diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b28a967..f01f131a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,9 +23,8 @@ Either command will start a HTTP server on port 8000 and open it in your browser ## Nixvim Architecture -Nixvim is mainly built around `pkgs.neovimUtils.makeNeovimConfig`. -This function takes a list of plugins (and a few other misc options), and generates a configuration for Neovim. -This can then be passed to `pkgs.wrapNeovimUnstable` to generate a derivation that bundles the plugins, extra programs and the Lua configuration. +Nixvim is mainly built around `pkgs.wrapNeovimUnstable`. +This wrapper takes a list of plugins and related options, and generates a derivation that bundles the plugins, extra programs and the Lua configuration. All the options that Nixvim exposes end up in those three places. This is done in the `modules/output.nix` file. diff --git a/modules/top-level/output.nix b/modules/top-level/output.nix index d49c5854..b95c5c7f 100644 --- a/modules/top-level/output.nix +++ b/modules/top-level/output.nix @@ -7,7 +7,7 @@ }: let inherit (lib) types mkOption mkPackageOption; - inherit (lib) optional optionalAttrs; + inherit (lib) optional; builders = lib.nixvim.builders.withPkgs pkgs; inherit (pkgs.stdenv.hostPlatform) system; in @@ -199,8 +199,10 @@ in else config.extraLuaPackages; - neovimConfig = pkgs.neovimUtils.makeNeovimConfig ( - { + luaEnv = package.lua.withPackages extraLuaPackages; + + wrappedNeovim = + (pkgs.wrapNeovimUnstable package { inherit extraLuaPackages; inherit (config) extraPython3Packages @@ -212,29 +214,25 @@ in withPerl withPython3 ; - # inherit customRC; inherit (config.build) plugins; - } - # Necessary to make sure the runtime path is set properly in NixOS 22.05, - # or more generally before the commit: - # cda1f8ae468 - neovim: pass packpath via the wrapper - // optionalAttrs (lib.functionArgs pkgs.neovimUtils.makeNeovimConfig ? configure) { - configure.packages = { - nixvim = { - start = map (x: x.plugin) config.build.plugins; - opt = [ ]; - }; + wrapperArgs = lib.optionals (luaEnv != null) [ + "--prefix" + "LUA_PATH" + ";" + (package.lua.pkgs.luaLib.genLuaPathAbsStr luaEnv) + "--prefix" + "LUA_CPATH" + ";" + (package.lua.pkgs.luaLib.genLuaCPathAbsStr luaEnv) + ]; + }).overrideAttrs + { + # TODO: 2025-01-06 + # Wait for user feedback on disabling the fixup phase. + # Ideally this will be upstreamed to nixpkgs. + # See https://github.com/nix-community/nixvim/pull/3660#discussion_r2326250439 + dontFixup = true; }; - } - ); - - # TODO: 2025-01-06 - # Wait for user feedback on disabling the fixup phase. - # Ideally this will be upstreamed to nixpkgs. - # See https://github.com/nix-community/nixvim/pull/3660#discussion_r2326250439 - wrappedNeovim = (pkgs.wrapNeovimUnstable package neovimConfig).overrideAttrs { - dontFixup = true; - }; customRC = lib.nixvim.concatNonEmptyLines [ (lib.nixvim.wrapVimscriptForLua wrappedNeovim.initRc)