|
@@ -13,7 +13,6 @@
|
|
, blink-cmp
|
|
, blink-cmp
|
|
, fetchFromGitHub
|
|
, fetchFromGitHub
|
|
, fetchpatch
|
|
, fetchpatch
|
|
-, withLuadev ? false
|
|
|
|
}:
|
|
}:
|
|
let
|
|
let
|
|
buildNeovimPlugin = attrs: stdenv.mkDerivation ({
|
|
buildNeovimPlugin = attrs: stdenv.mkDerivation ({
|
|
@@ -73,24 +72,31 @@ let
|
|
++ [
|
|
++ [
|
|
extra-treesitter-textobjects
|
|
extra-treesitter-textobjects
|
|
blink-cmp
|
|
blink-cmp
|
|
- ] ++ lib.optionals withLuadev [
|
|
|
|
- pinnedPlugins."bfredl/nvim-luadev"
|
|
|
|
];
|
|
];
|
|
|
|
|
|
- generic = { initText ? "", enabledPlugins ? [], passthru ? {} }: stdenv.mkDerivation {
|
|
|
|
|
|
+ optionalPlugins = builtins.filter (p: p.optional) (lib.attrValues pinnedPlugins);
|
|
|
|
+
|
|
|
|
+ generic = { minimal ? false , startPlugins ? [] , optPlugins ? [] , passthru ? {} }: stdenv.mkDerivation {
|
|
pname = "nvim";
|
|
pname = "nvim";
|
|
version = neovim-unwrapped.version;
|
|
version = neovim-unwrapped.version;
|
|
|
|
|
|
- initVim = ''
|
|
|
|
- let g:loaded_python3_provider = 0
|
|
|
|
- let g:loaded_ruby_provider = 0
|
|
|
|
- let g:loaded_node_provider = 0
|
|
|
|
- let g:loaded_perl_provider = 0
|
|
|
|
|
|
+ initLua = ''
|
|
|
|
+ vim.g.loaded_python3_provider = 0
|
|
|
|
+ vim.g.loaded_ruby_provider = 0
|
|
|
|
+ vim.g.loaded_node_provider = 0
|
|
|
|
+ vim.g.loaded_perl_provider = 0
|
|
|
|
+
|
|
|
|
+ vim.o.runtimepath = table.concat({
|
|
|
|
+ '${placeholder "out"}/lib',
|
|
|
|
+ vim.env.VIMRUNTIME,
|
|
|
|
+ '${placeholder "out"}/lib/after',
|
|
|
|
+ }, ',')
|
|
|
|
|
|
- set runtimepath=${placeholder "out"}/lib,$VIMRUNTIME
|
|
|
|
- set packpath=${placeholder "out"}/lib,$VIMRUNTIME
|
|
|
|
|
|
+ vim.o.packpath = table.concat({
|
|
|
|
+ '${placeholder "out"}/lib',
|
|
|
|
+ vim.env.VIMRUNTIME,
|
|
|
|
+ }, ',')
|
|
|
|
|
|
- lua <<EOF
|
|
|
|
-- make sure docs in our packpath are marked as help
|
|
-- make sure docs in our packpath are marked as help
|
|
vim.filetype.add({
|
|
vim.filetype.add({
|
|
pattern = {
|
|
pattern = {
|
|
@@ -98,12 +104,11 @@ let
|
|
['.*/pack/.*/doc/.*%.txt'] = 'help',
|
|
['.*/pack/.*/doc/.*%.txt'] = 'help',
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- EOF
|
|
|
|
|
|
|
|
- ${initText}
|
|
|
|
|
|
+ ${if minimal then "" else "require('user')"}
|
|
'';
|
|
'';
|
|
|
|
|
|
- passAsFile = [ "initVim" ];
|
|
|
|
|
|
+ passAsFile = [ "initLua" ];
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
@@ -114,15 +119,19 @@ let
|
|
mkdir -p lib/pack/nixpkgs/start
|
|
mkdir -p lib/pack/nixpkgs/start
|
|
${lib.concatMapStringsSep "\n" (p: ''
|
|
${lib.concatMapStringsSep "\n" (p: ''
|
|
ln -s "${p}" "lib/pack/nixpkgs/start/${lib.getName p}"
|
|
ln -s "${p}" "lib/pack/nixpkgs/start/${lib.getName p}"
|
|
- '') enabledPlugins}
|
|
|
|
|
|
+ '') startPlugins}
|
|
|
|
|
|
- # copy in overrides
|
|
|
|
- mkdir -p lib/pack/nixpkgs/start
|
|
|
|
- cp -r ${./overrides} lib/pack/nixpkgs/start/overrides
|
|
|
|
|
|
+ mkdir -p lib/pack/nixpkgs/opt
|
|
|
|
+ ${lib.concatMapStringsSep "\n" (p: ''
|
|
|
|
+ ln -s "${p}" "lib/pack/nixpkgs/opt/${lib.getName p}"
|
|
|
|
+ '') optPlugins}
|
|
|
|
+
|
|
|
|
+ # copy in config
|
|
|
|
+ cp -r ${./config}/. lib/
|
|
|
|
|
|
# create config file
|
|
# create config file
|
|
mkdir etc
|
|
mkdir etc
|
|
- cp "$initVimPath" etc/init.vim
|
|
|
|
|
|
+ cp "$initLuaPath" etc/init.lua
|
|
|
|
|
|
# symlink in man pages
|
|
# symlink in man pages
|
|
mkdir -p share
|
|
mkdir -p share
|
|
@@ -133,7 +142,7 @@ let
|
|
makeWrapper ${neovim-unwrapped}/bin/nvim bin/nvim \
|
|
makeWrapper ${neovim-unwrapped}/bin/nvim bin/nvim \
|
|
--prefix PATH : ${lib.makeBinPath extraPath} \
|
|
--prefix PATH : ${lib.makeBinPath extraPath} \
|
|
--add-flags -u \
|
|
--add-flags -u \
|
|
- --add-flags $out/etc/init.vim
|
|
|
|
|
|
+ --add-flags $out/etc/init.lua
|
|
'';
|
|
'';
|
|
|
|
|
|
inherit passthru;
|
|
inherit passthru;
|
|
@@ -145,21 +154,10 @@ let
|
|
};
|
|
};
|
|
in
|
|
in
|
|
generic {
|
|
generic {
|
|
- initText = ''
|
|
|
|
- source ${./settings.lua}
|
|
|
|
- source ${./plugins.lua}
|
|
|
|
- source ${./mappings.lua}
|
|
|
|
- source ${./autocmd.lua}
|
|
|
|
- source ${./lsp.lua}
|
|
|
|
- source ${./commands.lua}
|
|
|
|
- source ${./theme.lua}
|
|
|
|
- '' + lib.optionalString withLuadev ''
|
|
|
|
- source ${./luadev.lua}
|
|
|
|
- '';
|
|
|
|
-
|
|
|
|
- enabledPlugins = plugins;
|
|
|
|
|
|
+ startPlugins = plugins;
|
|
|
|
+ optPlugins = optionalPlugins;
|
|
|
|
|
|
passthru = {
|
|
passthru = {
|
|
- minimal = generic {};
|
|
|
|
|
|
+ minimal = generic { minimal = true; };
|
|
};
|
|
};
|
|
}
|
|
}
|