This repository has been archived on 2024-05-02. You can view files and clone it, but cannot push or open issues or pull requests.
neovim-flake/nix/lib/mkNeovimConfig.nix

62 lines
1.1 KiB
Nix

{ pkgs
, lib
, stdenv
, ...
}:
with lib;
{ runtimepath ? ../../nvim
, viAlias ? true
, vimAlias ? true
, withPython3 ? true
, extraPackages ? [ ]
, extraPython3Packages ? (_: [ ])
, withNodeJs ? false
, withRuby ? true
, extraLuaPackages ? (_: [ ])
, plugins ? [ ]
, customLuaRcContent ? ""
, ...
}:
let
rtp = stdenv.mkDerivation {
name = "neovim-runtimepath";
src = runtimepath;
buildPhase = ''
mkdir -p $out/nvim
'';
installPhase = ''
cp -r * $out/nvim
'';
};
luaRcContent =
''
vim.opt.runtimepath:prepend('${rtp}/nvim')
vim.opt.runtimepath:append('${rtp}/nvim/after')
'';
neovim = pkgs.neovimUtils.makeNeovimConfig {
inherit extraPython3Packages withPython3 withRuby withNodeJs viAlias vimAlias
plugins luaRcContent;
};
makeWrapperArgs =
let
binPath = lib.makeBinPath (
lib.optionals
(extraPackages
!= [ ])
extraPackages);
in
[ ] ++
lib.optionals (binPath != "") [
"--suffix"
"PATH"
":"
binPath
];
in
neovim // { wrapperArgs = makeWrapperArgs; }