···5757 # our config
5858 userConfig,
59596060+ # PERF: clean runtime path so it only contains explicit runtime directories
6161+ # - removes directories from homedir as well as nix data directories
6262+ # - this means some programs that ship extra nvim data files need to be
6363+ # explicitly added to the rtp with a package override
6464+ cleanRuntimePath ? false,
6565+ additionalRuntimePaths ? [ ],
6666+6067 # other customisation
6168 aliases ? [ ],
6269 keepDesktopFiles ? false,
···115122 package.cpath = "${luaLib.genLuaCPathAbsStr luaEnv};$LUA_CPATH" .. package.cpath
116123 vim.env.PATH = vim.env.PATH .. ":${makeBinPath extraPackages}"
117124 vim.g.snippets_path = "$out/pack/${pname}/start/init-plugin/snippets"
118118- vim.opt.packpath:prepend('$out')
119119- vim.opt.runtimepath:prepend('$out')
120120-125125+ ''
126126+ + (
127127+ if cleanRuntimePath then
128128+ (
129129+ let
130130+ # if the runtime path is cleaned, it will be faster to leave the nvim
131131+ # base paths at the start since most startup dependencies will be
132132+ # found there.
133133+ # $out will be put *before* the additionalRuntimePaths to replicate the behavior of `:prepend('$out')`.
134134+ runtimePaths = [
135135+ "${basePackage}/lib/nvim"
136136+ "${basePackage}/share/nvim/runtime"
137137+ "$out"
138138+ ]
139139+ ++ additionalRuntimePaths;
140140+ rtp = builtins.concatStringsSep "," runtimePaths;
141141+ in
142142+ ''
143143+ vim.o.runtimepath = "${rtp}"
144144+ vim.o.packpath = "${rtp}"
145145+ ''
146146+ )
147147+ else
148148+ ''
149149+ vim.opt.runtimepath:prepend('$out')
150150+ vim.opt.packpath:prepend('$out')
151151+ ''
152152+ )
153153+ + ''
121154 vim.loader.enable()
122155123156 ${lib.concatMapAttrsStringSep "\n" (provider: enabled: ''