Vim/lua: format (#382446)
This commit is contained in:
@@ -1,41 +1,50 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, lua
|
||||
, toVimPlugin
|
||||
{
|
||||
lib,
|
||||
lua,
|
||||
toVimPlugin,
|
||||
}:
|
||||
let
|
||||
# sanitizeDerivationName
|
||||
normalizeName = lib.replaceStrings [ "." ] [ "-" ];
|
||||
in
|
||||
|
||||
# function to create vim plugin from lua packages that are already packaged in
|
||||
# luaPackages
|
||||
{
|
||||
# the lua derivation to convert into a neovim plugin
|
||||
luaAttr ? (lua.pkgs.${normalizeName attrs.pname})
|
||||
, ...
|
||||
}@attrs:
|
||||
let
|
||||
originalLuaDrv = if (lib.typeOf luaAttr == "string") then
|
||||
lib.warn "luaAttr as string is deprecated since September 2024. Pass a lua derivation directly ( e.g., `buildNeovimPlugin { luaAttr = lua.pkgs.plenary-nvim; }`)" lua.pkgs.${normalizeName luaAttr}
|
||||
else luaAttr;
|
||||
# function to create vim plugin from lua packages that are already packaged in
|
||||
# luaPackages
|
||||
{
|
||||
# the lua derivation to convert into a neovim plugin
|
||||
luaAttr ? (lua.pkgs.${normalizeName attrs.pname}),
|
||||
...
|
||||
}@attrs:
|
||||
let
|
||||
originalLuaDrv =
|
||||
if (lib.typeOf luaAttr == "string") then
|
||||
lib.warn
|
||||
"luaAttr as string is deprecated since September 2024. Pass a lua derivation directly ( e.g., `buildNeovimPlugin { luaAttr = lua.pkgs.plenary-nvim; }`)"
|
||||
lua.pkgs.${normalizeName luaAttr}
|
||||
else
|
||||
luaAttr;
|
||||
|
||||
luaDrv = originalLuaDrv.overrideAttrs (oa: {
|
||||
version = attrs.version or oa.version;
|
||||
rockspecVersion = oa.rockspecVersion;
|
||||
|
||||
luaDrv = originalLuaDrv.overrideAttrs (oa: {
|
||||
version = attrs.version or oa.version;
|
||||
rockspecVersion = oa.rockspecVersion;
|
||||
extraConfig = ''
|
||||
-- to create a flat hierarchy
|
||||
lua_modules_path = "lua"
|
||||
'';
|
||||
});
|
||||
|
||||
extraConfig = ''
|
||||
-- to create a flat hierarchy
|
||||
lua_modules_path = "lua"
|
||||
'';
|
||||
});
|
||||
|
||||
finalDrv = toVimPlugin (luaDrv.overrideAttrs(oa: attrs // {
|
||||
nativeBuildInputs = oa.nativeBuildInputs or [] ++ [
|
||||
lua.pkgs.luarocksMoveDataFolder
|
||||
];
|
||||
version = "${originalLuaDrv.version}-unstable-${oa.version}";
|
||||
}));
|
||||
in
|
||||
finalDrv
|
||||
finalDrv = toVimPlugin (
|
||||
luaDrv.overrideAttrs (
|
||||
oa:
|
||||
attrs
|
||||
// {
|
||||
nativeBuildInputs = oa.nativeBuildInputs or [ ] ++ [
|
||||
lua.pkgs.luarocksMoveDataFolder
|
||||
];
|
||||
version = "${originalLuaDrv.version}-unstable-${oa.version}";
|
||||
}
|
||||
)
|
||||
);
|
||||
in
|
||||
finalDrv
|
||||
|
||||
@@ -171,7 +171,7 @@ let
|
||||
withPython3 ? true,
|
||||
withNodeJs ? false,
|
||||
withRuby ? true,
|
||||
# perl is problematic https://github.com/NixOS/nixpkgs/issues/132368
|
||||
# Perl is problematic https://github.com/NixOS/nixpkgs/issues/132368
|
||||
withPerl ? false,
|
||||
|
||||
# so that we can pass the full neovim config while ignoring it
|
||||
@@ -272,7 +272,7 @@ let
|
||||
));
|
||||
|
||||
/*
|
||||
Fork of vimUtils.packDir that additionnally generates a propagated-build-inputs-file that
|
||||
Fork of vimUtils.packDir that additionally generates a propagated-build-inputs-file that
|
||||
can be used by the lua hooks to generate a proper LUA_PATH
|
||||
|
||||
Generates a packpath folder as expected by vim
|
||||
@@ -286,14 +286,14 @@ let
|
||||
rawPackDir = vimUtils.packDir packages;
|
||||
|
||||
in
|
||||
rawPackDir.override ({
|
||||
rawPackDir.override {
|
||||
postBuild = ''
|
||||
mkdir $out/nix-support
|
||||
for i in $(find -L $out -name propagated-build-inputs ); do
|
||||
cat "$i" >> $out/nix-support/propagated-build-inputs
|
||||
done
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
{ stdenv, symlinkJoin, lib, makeWrapper
|
||||
, bundlerEnv
|
||||
, ruby
|
||||
, nodejs
|
||||
, writeText
|
||||
, neovim-node-client
|
||||
, python3
|
||||
, callPackage
|
||||
, neovimUtils
|
||||
, perl
|
||||
, lndir
|
||||
, vimUtils
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
makeWrapper,
|
||||
bundlerEnv,
|
||||
ruby,
|
||||
nodejs,
|
||||
writeText,
|
||||
neovim-node-client,
|
||||
python3,
|
||||
callPackage,
|
||||
neovimUtils,
|
||||
perl,
|
||||
lndir,
|
||||
vimUtils,
|
||||
}:
|
||||
|
||||
neovim-unwrapped:
|
||||
@@ -18,290 +21,359 @@ let
|
||||
# inherit interpreter from neovim
|
||||
lua = neovim-unwrapped.lua;
|
||||
|
||||
wrapper = {
|
||||
extraName ? ""
|
||||
# certain plugins need a custom configuration (available in passthru.initLua)
|
||||
# to work with nix.
|
||||
# if true, the wrapper automatically appends those snippets when necessary
|
||||
, autoconfigure ? true
|
||||
wrapper =
|
||||
{
|
||||
extraName ? "",
|
||||
# certain plugins need a custom configuration (available in passthru.initLua)
|
||||
# to work with nix.
|
||||
# if true, the wrapper automatically appends those snippets when necessary
|
||||
autoconfigure ? true,
|
||||
|
||||
# append to PATH runtime deps of plugins
|
||||
, autowrapRuntimeDeps ? true
|
||||
# append to PATH runtime deps of plugins
|
||||
autowrapRuntimeDeps ? true,
|
||||
|
||||
# should contain all args but the binary. Can be either a string or list
|
||||
, wrapperArgs ? []
|
||||
, withPython2 ? false
|
||||
, withPython3 ? true
|
||||
/* the function you would have passed to python3.withPackages */
|
||||
, extraPython3Packages ? (_: [ ])
|
||||
# should contain all args but the binary. Can be either a string or list
|
||||
wrapperArgs ? [ ],
|
||||
withPython2 ? false,
|
||||
withPython3 ? true,
|
||||
# the function you would have passed to python3.withPackages
|
||||
extraPython3Packages ? (_: [ ]),
|
||||
|
||||
, withNodeJs ? false
|
||||
, withPerl ? false
|
||||
, withRuby ? true
|
||||
withNodeJs ? false,
|
||||
withPerl ? false,
|
||||
withRuby ? true,
|
||||
|
||||
# wether to create symlinks in $out/bin/vi(m) -> $out/bin/nvim
|
||||
, vimAlias ? false
|
||||
, viAlias ? false
|
||||
# wether to create symlinks in $out/bin/vi(m) -> $out/bin/nvim
|
||||
vimAlias ? false,
|
||||
viAlias ? false,
|
||||
|
||||
# additional argument not generated by makeNeovimConfig
|
||||
# it will append "-u <customRc>" to the wrapped arguments
|
||||
# set to false if you want to control where to save the generated config
|
||||
# (e.g., in ~/.config/init.vim or project/.nvimrc)
|
||||
, wrapRc ? true
|
||||
# vimL code that should be sourced as part of the generated init.lua file
|
||||
, neovimRcContent ? null
|
||||
# lua code to put into the generated init.lua file
|
||||
, luaRcContent ? ""
|
||||
# DEPRECATED: entry to load in packpath
|
||||
# use 'plugins' instead
|
||||
, packpathDirs ? null # not used anymore
|
||||
# additional argument not generated by makeNeovimConfig
|
||||
# it will append "-u <customRc>" to the wrapped arguments
|
||||
# set to false if you want to control where to save the generated config
|
||||
# (e.g., in ~/.config/init.vim or project/.nvimrc)
|
||||
wrapRc ? true,
|
||||
# vimL code that should be sourced as part of the generated init.lua file
|
||||
neovimRcContent ? null,
|
||||
# lua code to put into the generated init.lua file
|
||||
luaRcContent ? "",
|
||||
# DEPRECATED: entry to load in packpath
|
||||
# use 'plugins' instead
|
||||
packpathDirs ? null, # not used anymore
|
||||
|
||||
# a list of neovim plugin derivations, for instance
|
||||
# plugins = [
|
||||
# { plugin=far-vim; config = "let g:far#source='rg'"; optional = false; }
|
||||
# ]
|
||||
, plugins ? []
|
||||
, ...
|
||||
}@attrs:
|
||||
assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env.";
|
||||
# a list of neovim plugin derivations, for instance
|
||||
# plugins = [
|
||||
# { plugin=far-vim; config = "let g:far#source='rg'"; optional = false; }
|
||||
# ]
|
||||
plugins ? [ ],
|
||||
...
|
||||
}@attrs:
|
||||
assert
|
||||
withPython2
|
||||
-> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env.";
|
||||
|
||||
assert packpathDirs != null -> throw "packpathdirs is not used anymore: pass a list of neovim plugin derivations in 'plugins' instead.";
|
||||
assert
|
||||
packpathDirs != null
|
||||
-> throw "packpathdirs is not used anymore: pass a list of neovim plugin derivations in 'plugins' instead.";
|
||||
|
||||
stdenv.mkDerivation (finalAttrs:
|
||||
let
|
||||
pluginsNormalized = neovimUtils.normalizePlugins finalAttrs.plugins;
|
||||
stdenv.mkDerivation (
|
||||
finalAttrs:
|
||||
let
|
||||
pluginsNormalized = neovimUtils.normalizePlugins finalAttrs.plugins;
|
||||
|
||||
myVimPackage = neovimUtils.normalizedPluginsToVimPackage pluginsNormalized;
|
||||
myVimPackage = neovimUtils.normalizedPluginsToVimPackage pluginsNormalized;
|
||||
|
||||
rubyEnv = bundlerEnv {
|
||||
name = "neovim-ruby-env";
|
||||
gemdir = ./ruby_provider;
|
||||
postBuild = ''
|
||||
ln -sf ${ruby}/bin/* $out/bin
|
||||
'';
|
||||
};
|
||||
rubyEnv = bundlerEnv {
|
||||
name = "neovim-ruby-env";
|
||||
gemdir = ./ruby_provider;
|
||||
postBuild = ''
|
||||
ln -sf ${ruby}/bin/* $out/bin
|
||||
'';
|
||||
};
|
||||
|
||||
pluginRC = lib.foldl (acc: p: if p.config != null then acc ++ [p.config] else acc) [] pluginsNormalized;
|
||||
pluginRC = lib.foldl (
|
||||
acc: p: if p.config != null then acc ++ [ p.config ] else acc
|
||||
) [ ] pluginsNormalized;
|
||||
|
||||
# a limited RC script used only to generate the manifest for remote plugins
|
||||
manifestRc = "";
|
||||
# we call vimrcContent without 'packages' to avoid the init.vim generation
|
||||
neovimRcContent' = lib.concatStringsSep "\n" (pluginRC ++ lib.optional (neovimRcContent != null) neovimRcContent);
|
||||
# a limited RC script used only to generate the manifest for remote plugins
|
||||
manifestRc = "";
|
||||
# we call vimrcContent without 'packages' to avoid the init.vim generation
|
||||
neovimRcContent' = lib.concatStringsSep "\n" (
|
||||
pluginRC ++ lib.optional (neovimRcContent != null) neovimRcContent
|
||||
);
|
||||
|
||||
packpathDirs.myNeovimPackages = myVimPackage;
|
||||
finalPackdir = neovimUtils.packDir packpathDirs;
|
||||
packpathDirs.myNeovimPackages = myVimPackage;
|
||||
finalPackdir = neovimUtils.packDir packpathDirs;
|
||||
|
||||
luaPluginRC = let
|
||||
op = acc: normalizedPlugin:
|
||||
acc ++ lib.optional (finalAttrs.autoconfigure && normalizedPlugin.plugin.passthru ? initLua) normalizedPlugin.plugin.passthru.initLua;
|
||||
luaPluginRC =
|
||||
let
|
||||
op =
|
||||
acc: normalizedPlugin:
|
||||
acc
|
||||
++ lib.optional (
|
||||
finalAttrs.autoconfigure && normalizedPlugin.plugin.passthru ? initLua
|
||||
) normalizedPlugin.plugin.passthru.initLua;
|
||||
in
|
||||
lib.foldl' op [ ] pluginsNormalized;
|
||||
|
||||
rcContent =
|
||||
''
|
||||
${luaRcContent}
|
||||
''
|
||||
+ lib.optionalString (neovimRcContent' != null) ''
|
||||
vim.cmd.source "${writeText "init.vim" neovimRcContent'}"
|
||||
''
|
||||
+ lib.concatStringsSep "\n" luaPluginRC;
|
||||
|
||||
getDeps = attrname: map (plugin: plugin.${attrname} or (_: [ ]));
|
||||
|
||||
requiredPlugins = vimUtils.requiredPluginsForPackage myVimPackage;
|
||||
pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins;
|
||||
|
||||
python3Env =
|
||||
lib.warnIf (attrs ? python3Env)
|
||||
"Pass your python packages via the `extraPython3Packages`, e.g., `extraPython3Packages = ps: [ ps.pandas ]`"
|
||||
python3.pkgs.python.withPackages
|
||||
(ps: [ ps.pynvim ] ++ (extraPython3Packages ps) ++ (lib.concatMap (f: f ps) pluginPython3Packages));
|
||||
|
||||
wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs;
|
||||
|
||||
generatedWrapperArgs =
|
||||
[
|
||||
# vim accepts a limited number of commands so we join all the provider ones
|
||||
"--add-flags"
|
||||
''--cmd "lua ${providerLuaRc}"''
|
||||
]
|
||||
++
|
||||
lib.optionals
|
||||
(
|
||||
finalAttrs.packpathDirs.myNeovimPackages.start != [ ]
|
||||
|| finalAttrs.packpathDirs.myNeovimPackages.opt != [ ]
|
||||
)
|
||||
[
|
||||
"--add-flags"
|
||||
''--cmd "set packpath^=${finalPackdir}"''
|
||||
"--add-flags"
|
||||
''--cmd "set rtp^=${finalPackdir}"''
|
||||
]
|
||||
++ lib.optionals finalAttrs.withRuby [
|
||||
"--set"
|
||||
"GEM_HOME"
|
||||
"${rubyEnv}/${rubyEnv.ruby.gemPath}"
|
||||
]
|
||||
++ lib.optionals (finalAttrs.runtimeDeps != [ ]) [
|
||||
"--suffix"
|
||||
"PATH"
|
||||
":"
|
||||
(lib.makeBinPath finalAttrs.runtimeDeps)
|
||||
];
|
||||
|
||||
providerLuaRc = neovimUtils.generateProviderRc {
|
||||
inherit (finalAttrs)
|
||||
withPython3
|
||||
withNodeJs
|
||||
withPerl
|
||||
withRuby
|
||||
;
|
||||
};
|
||||
|
||||
# If `configure` != {}, we can't generate the rplugin.vim file with e.g
|
||||
# NVIM_SYSTEM_RPLUGIN_MANIFEST *and* NVIM_RPLUGIN_MANIFEST env vars set in
|
||||
# the wrapper. That's why only when `configure` != {} (tested both here and
|
||||
# when `postBuild` is evaluated), we call makeWrapper once to generate a
|
||||
# wrapper with most arguments we need, excluding those that cause problems to
|
||||
# generate rplugin.vim, but still required for the final wrapper.
|
||||
finalMakeWrapperArgs =
|
||||
[
|
||||
"${neovim-unwrapped}/bin/nvim"
|
||||
"${placeholder "out"}/bin/nvim"
|
||||
]
|
||||
++ [
|
||||
"--set"
|
||||
"NVIM_SYSTEM_RPLUGIN_MANIFEST"
|
||||
"${placeholder "out"}/rplugin.vim"
|
||||
]
|
||||
++ lib.optionals finalAttrs.wrapRc [
|
||||
"--add-flags"
|
||||
"-u ${writeText "init.lua" rcContent}"
|
||||
]
|
||||
++ finalAttrs.generatedWrapperArgs;
|
||||
|
||||
perlEnv = perl.withPackages (p: [
|
||||
p.NeovimExt
|
||||
p.Appcpanminus
|
||||
]);
|
||||
|
||||
pname = "neovim";
|
||||
version = lib.getVersion neovim-unwrapped;
|
||||
in
|
||||
lib.foldl' op [] pluginsNormalized;
|
||||
{
|
||||
name = "${pname}-${version}${extraName}";
|
||||
inherit pname version;
|
||||
inherit plugins;
|
||||
|
||||
rcContent = ''
|
||||
${luaRcContent}
|
||||
'' + lib.optionalString (neovimRcContent' != null) ''
|
||||
vim.cmd.source "${writeText "init.vim" neovimRcContent'}"
|
||||
'' +
|
||||
lib.concatStringsSep "\n" luaPluginRC
|
||||
;
|
||||
__structuredAttrs = true;
|
||||
dontUnpack = true;
|
||||
inherit
|
||||
viAlias
|
||||
vimAlias
|
||||
withNodeJs
|
||||
withPython3
|
||||
withPerl
|
||||
withRuby
|
||||
;
|
||||
inherit
|
||||
autoconfigure
|
||||
autowrapRuntimeDeps
|
||||
wrapRc
|
||||
providerLuaRc
|
||||
packpathDirs
|
||||
;
|
||||
inherit python3Env rubyEnv;
|
||||
inherit wrapperArgs generatedWrapperArgs;
|
||||
|
||||
getDeps = attrname: map (plugin: plugin.${attrname} or (_: [ ]));
|
||||
runtimeDeps =
|
||||
let
|
||||
op = acc: normalizedPlugin: acc ++ normalizedPlugin.plugin.runtimeDeps or [ ];
|
||||
runtimeDeps = lib.foldl' op [ ] pluginsNormalized;
|
||||
in
|
||||
lib.optional finalAttrs.withRuby rubyEnv
|
||||
++ lib.optional finalAttrs.withNodeJs nodejs
|
||||
++ lib.optionals finalAttrs.autowrapRuntimeDeps runtimeDeps;
|
||||
|
||||
requiredPlugins = vimUtils.requiredPluginsForPackage myVimPackage;
|
||||
pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins;
|
||||
luaRcContent = rcContent;
|
||||
# Remove the symlinks created by symlinkJoin which we need to perform
|
||||
# extra actions upon
|
||||
postBuild =
|
||||
lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
rm $out/share/applications/nvim.desktop
|
||||
substitute ${neovim-unwrapped}/share/applications/nvim.desktop $out/share/applications/nvim.desktop \
|
||||
--replace-warn 'Name=Neovim' 'Name=Neovim wrapper'
|
||||
''
|
||||
+ lib.optionalString finalAttrs.withPython3 ''
|
||||
makeWrapper ${python3Env.interpreter} $out/bin/nvim-python3 --unset PYTHONPATH --unset PYTHONSAFEPATH
|
||||
''
|
||||
+ lib.optionalString (finalAttrs.withRuby) ''
|
||||
ln -s ${finalAttrs.rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby
|
||||
''
|
||||
+ lib.optionalString finalAttrs.withNodeJs ''
|
||||
ln -s ${neovim-node-client}/bin/neovim-node-host $out/bin/nvim-node
|
||||
''
|
||||
+ lib.optionalString finalAttrs.withPerl ''
|
||||
ln -s ${perlEnv}/bin/perl $out/bin/nvim-perl
|
||||
''
|
||||
+ lib.optionalString finalAttrs.vimAlias ''
|
||||
ln -s $out/bin/nvim $out/bin/vim
|
||||
''
|
||||
+ lib.optionalString finalAttrs.viAlias ''
|
||||
ln -s $out/bin/nvim $out/bin/vi
|
||||
''
|
||||
+ lib.optionalString (manifestRc != null) (
|
||||
let
|
||||
manifestWrapperArgs = [
|
||||
"${neovim-unwrapped}/bin/nvim"
|
||||
"${placeholder "out"}/bin/nvim-wrapper"
|
||||
] ++ finalAttrs.generatedWrapperArgs;
|
||||
in
|
||||
''
|
||||
echo "Generating remote plugin manifest"
|
||||
export NVIM_RPLUGIN_MANIFEST=$out/rplugin.vim
|
||||
makeWrapper ${lib.escapeShellArgs manifestWrapperArgs} ${wrapperArgsStr}
|
||||
|
||||
python3Env = lib.warnIf (attrs ? python3Env) "Pass your python packages via the `extraPython3Packages`, e.g., `extraPython3Packages = ps: [ ps.pandas ]`"
|
||||
python3.pkgs.python.withPackages (ps:
|
||||
[ ps.pynvim ]
|
||||
++ (extraPython3Packages ps)
|
||||
++ (lib.concatMap (f: f ps) pluginPython3Packages));
|
||||
# Some plugins assume that the home directory is accessible for
|
||||
# initializing caches, temporary files, etc. Even if the plugin isn't
|
||||
# actively used, it may throw an error as soon as Neovim is launched
|
||||
# (e.g., inside an autoload script), causing manifest generation to
|
||||
# fail. Therefore, let's create a fake home directory before generating
|
||||
# the manifest, just to satisfy the needs of these plugins.
|
||||
#
|
||||
# See https://github.com/Yggdroot/LeaderF/blob/v1.21/autoload/lfMru.vim#L10
|
||||
# for an example of this behavior.
|
||||
export HOME="$(mktemp -d)"
|
||||
# Launch neovim with a vimrc file containing only the generated plugin
|
||||
# code. Pass various flags to disable temp file generation
|
||||
# (swap/viminfo) and redirect errors to stderr.
|
||||
# Only display the log on error since it will contain a few normally
|
||||
# irrelevant messages.
|
||||
if ! $out/bin/nvim-wrapper \
|
||||
-u ${writeText "manifest.vim" manifestRc} \
|
||||
-i NONE -n \
|
||||
-V1rplugins.log \
|
||||
+UpdateRemotePlugins +quit! > outfile 2>&1; then
|
||||
cat outfile
|
||||
echo -e "\nGenerating rplugin.vim failed!"
|
||||
exit 1
|
||||
fi
|
||||
rm "${placeholder "out"}/bin/nvim-wrapper"
|
||||
''
|
||||
)
|
||||
+ ''
|
||||
rm $out/bin/nvim
|
||||
touch $out/rplugin.vim
|
||||
|
||||
echo "Looking for lua dependencies..."
|
||||
source ${lua}/nix-support/utils.sh
|
||||
|
||||
wrapperArgsStr = if lib.isString wrapperArgs then wrapperArgs else lib.escapeShellArgs wrapperArgs;
|
||||
_addToLuaPath "${finalPackdir}"
|
||||
|
||||
generatedWrapperArgs =
|
||||
[
|
||||
# vim accepts a limited number of commands so we join all the provider ones
|
||||
"--add-flags" ''--cmd "lua ${providerLuaRc}"''
|
||||
]
|
||||
++ lib.optionals (finalAttrs.packpathDirs.myNeovimPackages.start != [] || finalAttrs.packpathDirs.myNeovimPackages.opt != []) [
|
||||
"--add-flags" ''--cmd "set packpath^=${finalPackdir}"''
|
||||
"--add-flags" ''--cmd "set rtp^=${finalPackdir}"''
|
||||
]
|
||||
++ lib.optionals finalAttrs.withRuby [
|
||||
"--set" "GEM_HOME" "${rubyEnv}/${rubyEnv.ruby.gemPath}"
|
||||
] ++ lib.optionals (finalAttrs.runtimeDeps != []) [
|
||||
"--suffix" "PATH" ":" (lib.makeBinPath finalAttrs.runtimeDeps)
|
||||
]
|
||||
echo "LUA_PATH towards the end of packdir: $LUA_PATH"
|
||||
|
||||
makeWrapper ${lib.escapeShellArgs finalMakeWrapperArgs} ${wrapperArgsStr} \
|
||||
--prefix LUA_PATH ';' "$LUA_PATH" \
|
||||
--prefix LUA_CPATH ';' "$LUA_CPATH"
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
mkdir -p $out
|
||||
for i in ${neovim-unwrapped}; do
|
||||
lndir -silent $i $out
|
||||
done
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
lndir
|
||||
];
|
||||
|
||||
# A Vim "package", see ':h packages'
|
||||
vimPackage = myVimPackage;
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
$out/bin/nvim -i NONE -e +quitall!
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit providerLuaRc packpathDirs;
|
||||
unwrapped = neovim-unwrapped;
|
||||
initRc = neovimRcContent';
|
||||
|
||||
tests = callPackage ./tests {
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
inherit (neovim-unwrapped.meta)
|
||||
description
|
||||
longDescription
|
||||
homepage
|
||||
mainProgram
|
||||
license
|
||||
maintainers
|
||||
platforms
|
||||
;
|
||||
|
||||
providerLuaRc = neovimUtils.generateProviderRc {
|
||||
inherit (finalAttrs) withPython3 withNodeJs withPerl withRuby;
|
||||
};
|
||||
|
||||
# If configure != {}, we can't generate the rplugin.vim file with e.g
|
||||
# NVIM_SYSTEM_RPLUGIN_MANIFEST *and* NVIM_RPLUGIN_MANIFEST env vars set in
|
||||
# the wrapper. That's why only when configure != {} (tested both here and
|
||||
# when postBuild is evaluated), we call makeWrapper once to generate a
|
||||
# wrapper with most arguments we need, excluding those that cause problems to
|
||||
# generate rplugin.vim, but still required for the final wrapper.
|
||||
finalMakeWrapperArgs =
|
||||
[ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim" ]
|
||||
++ [ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ]
|
||||
++ lib.optionals finalAttrs.wrapRc [ "--add-flags" "-u ${writeText "init.lua" rcContent}" ]
|
||||
++ finalAttrs.generatedWrapperArgs
|
||||
;
|
||||
|
||||
perlEnv = perl.withPackages (p: [ p.NeovimExt p.Appcpanminus ]);
|
||||
|
||||
pname = "neovim";
|
||||
version = lib.getVersion neovim-unwrapped;
|
||||
in {
|
||||
name = "${pname}-${version}${extraName}";
|
||||
inherit pname version;
|
||||
inherit plugins;
|
||||
|
||||
__structuredAttrs = true;
|
||||
dontUnpack = true;
|
||||
inherit viAlias vimAlias withNodeJs withPython3 withPerl withRuby;
|
||||
inherit autoconfigure autowrapRuntimeDeps wrapRc providerLuaRc packpathDirs;
|
||||
inherit python3Env rubyEnv;
|
||||
inherit wrapperArgs generatedWrapperArgs;
|
||||
|
||||
|
||||
runtimeDeps = let
|
||||
op = acc: normalizedPlugin: acc ++ normalizedPlugin.plugin.runtimeDeps or [];
|
||||
runtimeDeps = lib.foldl' op [] pluginsNormalized;
|
||||
in
|
||||
lib.optional finalAttrs.withRuby rubyEnv
|
||||
++ lib.optional finalAttrs.withNodeJs nodejs
|
||||
++ lib.optionals finalAttrs.autowrapRuntimeDeps runtimeDeps
|
||||
;
|
||||
|
||||
|
||||
luaRcContent = rcContent;
|
||||
# Remove the symlinks created by symlinkJoin which we need to perform
|
||||
# extra actions upon
|
||||
postBuild = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
rm $out/share/applications/nvim.desktop
|
||||
substitute ${neovim-unwrapped}/share/applications/nvim.desktop $out/share/applications/nvim.desktop \
|
||||
--replace-warn 'Name=Neovim' 'Name=Neovim wrapper'
|
||||
''
|
||||
+ lib.optionalString finalAttrs.withPython3 ''
|
||||
makeWrapper ${python3Env.interpreter} $out/bin/nvim-python3 --unset PYTHONPATH --unset PYTHONSAFEPATH
|
||||
''
|
||||
+ lib.optionalString (finalAttrs.withRuby) ''
|
||||
ln -s ${finalAttrs.rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby
|
||||
''
|
||||
+ lib.optionalString finalAttrs.withNodeJs ''
|
||||
ln -s ${neovim-node-client}/bin/neovim-node-host $out/bin/nvim-node
|
||||
''
|
||||
+ lib.optionalString finalAttrs.withPerl ''
|
||||
ln -s ${perlEnv}/bin/perl $out/bin/nvim-perl
|
||||
''
|
||||
+ lib.optionalString finalAttrs.vimAlias ''
|
||||
ln -s $out/bin/nvim $out/bin/vim
|
||||
''
|
||||
+ lib.optionalString finalAttrs.viAlias ''
|
||||
ln -s $out/bin/nvim $out/bin/vi
|
||||
''
|
||||
+ lib.optionalString (manifestRc != null) (let
|
||||
manifestWrapperArgs =
|
||||
[ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim-wrapper" ] ++ finalAttrs.generatedWrapperArgs;
|
||||
in ''
|
||||
echo "Generating remote plugin manifest"
|
||||
export NVIM_RPLUGIN_MANIFEST=$out/rplugin.vim
|
||||
makeWrapper ${lib.escapeShellArgs manifestWrapperArgs} ${wrapperArgsStr}
|
||||
|
||||
# Some plugins assume that the home directory is accessible for
|
||||
# initializing caches, temporary files, etc. Even if the plugin isn't
|
||||
# actively used, it may throw an error as soon as Neovim is launched
|
||||
# (e.g., inside an autoload script), causing manifest generation to
|
||||
# fail. Therefore, let's create a fake home directory before generating
|
||||
# the manifest, just to satisfy the needs of these plugins.
|
||||
#
|
||||
# See https://github.com/Yggdroot/LeaderF/blob/v1.21/autoload/lfMru.vim#L10
|
||||
# for an example of this behavior.
|
||||
export HOME="$(mktemp -d)"
|
||||
# Launch neovim with a vimrc file containing only the generated plugin
|
||||
# code. Pass various flags to disable temp file generation
|
||||
# (swap/viminfo) and redirect errors to stderr.
|
||||
# Only display the log on error since it will contain a few normally
|
||||
# irrelevant messages.
|
||||
if ! $out/bin/nvim-wrapper \
|
||||
-u ${writeText "manifest.vim" manifestRc} \
|
||||
-i NONE -n \
|
||||
-V1rplugins.log \
|
||||
+UpdateRemotePlugins +quit! > outfile 2>&1; then
|
||||
cat outfile
|
||||
echo -e "\nGenerating rplugin.vim failed!"
|
||||
exit 1
|
||||
fi
|
||||
rm "${placeholder "out"}/bin/nvim-wrapper"
|
||||
'')
|
||||
+ ''
|
||||
rm $out/bin/nvim
|
||||
touch $out/rplugin.vim
|
||||
|
||||
echo "Looking for lua dependencies..."
|
||||
source ${lua}/nix-support/utils.sh
|
||||
|
||||
_addToLuaPath "${finalPackdir}"
|
||||
|
||||
echo "LUA_PATH towards the end of packdir: $LUA_PATH"
|
||||
|
||||
makeWrapper ${lib.escapeShellArgs finalMakeWrapperArgs} ${wrapperArgsStr} \
|
||||
--prefix LUA_PATH ';' "$LUA_PATH" \
|
||||
--prefix LUA_CPATH ';' "$LUA_CPATH"
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
mkdir -p $out
|
||||
for i in ${neovim-unwrapped}; do
|
||||
lndir -silent $i $out
|
||||
done
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper lndir ];
|
||||
|
||||
# A Vim "package", see ':h packages'
|
||||
vimPackage = myVimPackage;
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
$out/bin/nvim -i NONE -e +quitall!
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit providerLuaRc packpathDirs;
|
||||
unwrapped = neovim-unwrapped;
|
||||
initRc = neovimRcContent';
|
||||
|
||||
tests = callPackage ./tests {
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
inherit (neovim-unwrapped.meta)
|
||||
description
|
||||
longDescription
|
||||
homepage
|
||||
mainProgram
|
||||
license
|
||||
maintainers
|
||||
platforms;
|
||||
|
||||
# To prevent builds on hydra
|
||||
hydraPlatforms = [];
|
||||
# prefer wrapper over the package
|
||||
priority = (neovim-unwrapped.meta.priority or lib.meta.defaultPriority) - 1;
|
||||
};
|
||||
});
|
||||
# To prevent builds on hydra
|
||||
hydraPlatforms = [ ];
|
||||
# prefer wrapper over the package
|
||||
priority = (neovim-unwrapped.meta.priority or lib.meta.defaultPriority) - 1;
|
||||
};
|
||||
}
|
||||
);
|
||||
in
|
||||
lib.makeOverridable wrapper
|
||||
lib.makeOverridable wrapper
|
||||
|
||||
@@ -1,72 +1,79 @@
|
||||
# do not add pkgs, it messes up splicing
|
||||
{ stdenv
|
||||
, cargo
|
||||
, cmake
|
||||
{
|
||||
stdenv,
|
||||
cargo,
|
||||
cmake,
|
||||
|
||||
# plenary utilities
|
||||
, which
|
||||
, findutils
|
||||
, clang
|
||||
, coreutils
|
||||
, curl
|
||||
, cyrus_sasl
|
||||
, dbus
|
||||
, expat
|
||||
, fetchFromGitHub
|
||||
, fetchpatch
|
||||
, fetchurl
|
||||
, fixDarwinDylibNames
|
||||
, glib
|
||||
, glibc
|
||||
, gmp
|
||||
, gnulib
|
||||
, gnum4
|
||||
, gobject-introspection
|
||||
, imagemagick
|
||||
, installShellFiles
|
||||
, lib
|
||||
, libevent
|
||||
, libiconv
|
||||
, libmpack
|
||||
, libmysqlclient
|
||||
, libpsl
|
||||
, libpq
|
||||
, libuuid
|
||||
, libuv
|
||||
, libxcrypt
|
||||
, libyaml
|
||||
, luajitPackages
|
||||
, lua-language-server
|
||||
, mariadb
|
||||
, magic-enum
|
||||
, mpfr
|
||||
, neovim-unwrapped
|
||||
, openldap
|
||||
, openssl
|
||||
, pcre
|
||||
, pkg-config
|
||||
, readline
|
||||
, rustPlatform
|
||||
, sol2
|
||||
, sqlite
|
||||
, tomlplusplus
|
||||
, tree-sitter
|
||||
, unbound
|
||||
, vimPlugins
|
||||
, vimUtils
|
||||
, yajl
|
||||
, zip
|
||||
, unzip
|
||||
, zlib
|
||||
, zziplib
|
||||
# plenary utilities
|
||||
which,
|
||||
findutils,
|
||||
clang,
|
||||
coreutils,
|
||||
curl,
|
||||
cyrus_sasl,
|
||||
dbus,
|
||||
expat,
|
||||
fetchFromGitHub,
|
||||
fetchpatch,
|
||||
fetchurl,
|
||||
fixDarwinDylibNames,
|
||||
glib,
|
||||
glibc,
|
||||
gmp,
|
||||
gnulib,
|
||||
gnum4,
|
||||
gobject-introspection,
|
||||
imagemagick,
|
||||
installShellFiles,
|
||||
lib,
|
||||
libevent,
|
||||
libiconv,
|
||||
libmpack,
|
||||
libmysqlclient,
|
||||
libpsl,
|
||||
libpq,
|
||||
libuuid,
|
||||
libuv,
|
||||
libxcrypt,
|
||||
libyaml,
|
||||
luajitPackages,
|
||||
lua-language-server,
|
||||
mariadb,
|
||||
magic-enum,
|
||||
mpfr,
|
||||
neovim-unwrapped,
|
||||
openldap,
|
||||
openssl,
|
||||
pcre,
|
||||
pkg-config,
|
||||
readline,
|
||||
rustPlatform,
|
||||
sol2,
|
||||
sqlite,
|
||||
tomlplusplus,
|
||||
tree-sitter,
|
||||
unbound,
|
||||
vimPlugins,
|
||||
vimUtils,
|
||||
yajl,
|
||||
zip,
|
||||
unzip,
|
||||
zlib,
|
||||
zziplib,
|
||||
}:
|
||||
|
||||
final: prev:
|
||||
let
|
||||
inherit (prev) luaOlder luaAtLeast lua isLuaJIT isLua51;
|
||||
inherit (prev)
|
||||
luaOlder
|
||||
luaAtLeast
|
||||
lua
|
||||
isLuaJIT
|
||||
isLua51
|
||||
;
|
||||
in
|
||||
{
|
||||
argparse = prev.argparse.overrideAttrs(oa: {
|
||||
argparse = prev.argparse.overrideAttrs (oa: {
|
||||
|
||||
doCheck = true;
|
||||
checkInputs = [ final.busted ];
|
||||
@@ -108,13 +115,14 @@ in
|
||||
|
||||
cqueues = prev.cqueues.overrideAttrs (oa: rec {
|
||||
# Parse out a version number without the Lua version inserted
|
||||
version = let
|
||||
version' = prev.cqueues.version;
|
||||
rel = lib.splitVersion version';
|
||||
date = lib.head rel;
|
||||
rev = lib.last (lib.splitString "-" (lib.last rel));
|
||||
in
|
||||
"${date}-${rev}";
|
||||
version =
|
||||
let
|
||||
version' = prev.cqueues.version;
|
||||
rel = lib.splitVersion version';
|
||||
date = lib.head rel;
|
||||
rev = lib.last (lib.splitString "-" (lib.last rel));
|
||||
in
|
||||
"${date}-${rev}";
|
||||
|
||||
meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
|
||||
|
||||
@@ -123,13 +131,22 @@ in
|
||||
];
|
||||
|
||||
externalDeps = [
|
||||
{ name = "CRYPTO"; dep = openssl; }
|
||||
{ name = "OPENSSL"; dep = openssl; }
|
||||
{
|
||||
name = "CRYPTO";
|
||||
dep = openssl;
|
||||
}
|
||||
{
|
||||
name = "OPENSSL";
|
||||
dep = openssl;
|
||||
}
|
||||
];
|
||||
|
||||
# Upstream rockspec is pointlessly broken into separate rockspecs, per Lua
|
||||
# version, which doesn't work well for us, so modify it
|
||||
postConfigure = let inherit (prev.cqueues) pname; in
|
||||
postConfigure =
|
||||
let
|
||||
inherit (prev.cqueues) pname;
|
||||
in
|
||||
''
|
||||
# 'all' target auto-detects correct Lua version, which is fine for us as
|
||||
# we only have the right one available :)
|
||||
@@ -145,7 +162,7 @@ in
|
||||
|
||||
# Until https://github.com/swarn/fzy-lua/pull/8 is merged,
|
||||
# we have to invoke busted manually
|
||||
fzy = prev.fzy.overrideAttrs(oa: {
|
||||
fzy = prev.fzy.overrideAttrs (oa: {
|
||||
doCheck = true;
|
||||
nativeCheckInputs = [ final.busted ];
|
||||
checkPhase = ''
|
||||
@@ -161,7 +178,8 @@ in
|
||||
sha256 = "1vmx039n3nqfx50faqhs3wgiw28ws416rhw6vh6srmh9i826dac7";
|
||||
})
|
||||
];
|
||||
/* TODO: separate docs derivation? (pandoc is heavy)
|
||||
/*
|
||||
TODO: separate docs derivation? (pandoc is heavy)
|
||||
nativeBuildInputs = [ pandoc ];
|
||||
makeFlags = [ "-C doc" "lua-http.html" "lua-http.3" ];
|
||||
*/
|
||||
@@ -242,42 +260,55 @@ in
|
||||
propagatedBuildInputs = oa.propagatedBuildInputs ++ [ lua-language-server ];
|
||||
});
|
||||
|
||||
lmathx = prev.luaLib.overrideLuarocks prev.lmathx (drv:
|
||||
if luaAtLeast "5.1" && luaOlder "5.2" then {
|
||||
version = "20120430.51-1";
|
||||
knownRockspec = (fetchurl {
|
||||
url = "mirror://luarocks/lmathx-20120430.51-1.rockspec";
|
||||
sha256 = "148vbv2g3z5si2db7rqg5bdily7m4sjyh9w6r3jnx3csvfaxyhp0";
|
||||
}).outPath;
|
||||
src = fetchurl {
|
||||
url = "https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/lmathx.tar.gz";
|
||||
sha256 = "0sa553d0zlxhvpsmr4r7d841f16yq4wr3fg7i07ibxkz6yzxax51";
|
||||
};
|
||||
} else
|
||||
if luaAtLeast "5.2" && luaOlder "5.3" then {
|
||||
lmathx = prev.luaLib.overrideLuarocks prev.lmathx (
|
||||
drv:
|
||||
if luaAtLeast "5.1" && luaOlder "5.2" then
|
||||
{
|
||||
version = "20120430.51-1";
|
||||
knownRockspec =
|
||||
(fetchurl {
|
||||
url = "mirror://luarocks/lmathx-20120430.51-1.rockspec";
|
||||
sha256 = "148vbv2g3z5si2db7rqg5bdily7m4sjyh9w6r3jnx3csvfaxyhp0";
|
||||
}).outPath;
|
||||
src = fetchurl {
|
||||
url = "https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/5.1/lmathx.tar.gz";
|
||||
sha256 = "0sa553d0zlxhvpsmr4r7d841f16yq4wr3fg7i07ibxkz6yzxax51";
|
||||
};
|
||||
}
|
||||
else if luaAtLeast "5.2" && luaOlder "5.3" then
|
||||
{
|
||||
version = "20120430.52-1";
|
||||
knownRockspec = (fetchurl {
|
||||
url = "mirror://luarocks/lmathx-20120430.52-1.rockspec";
|
||||
sha256 = "14rd625sipakm72wg6xqsbbglaxyjba9nsajsfyvhg0sz8qjgdya";
|
||||
}).outPath;
|
||||
knownRockspec =
|
||||
(fetchurl {
|
||||
url = "mirror://luarocks/lmathx-20120430.52-1.rockspec";
|
||||
sha256 = "14rd625sipakm72wg6xqsbbglaxyjba9nsajsfyvhg0sz8qjgdya";
|
||||
}).outPath;
|
||||
src = fetchurl {
|
||||
url = "http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.2/lmathx.tar.gz";
|
||||
sha256 = "19dwa4z266l2njgi6fbq9rak4rmx2fsx1s0p9sl166ar3mnrdwz5";
|
||||
};
|
||||
} else
|
||||
{
|
||||
disabled = luaOlder "5.1" || luaAtLeast "5.5";
|
||||
# works fine with 5.4 as well
|
||||
postConfigure = ''
|
||||
substituteInPlace ''${rockspecFilename} \
|
||||
--replace 'lua ~> 5.3' 'lua >= 5.3, < 5.5'
|
||||
'';
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
disabled = luaOlder "5.1" || luaAtLeast "5.5";
|
||||
# works fine with 5.4 as well
|
||||
postConfigure = ''
|
||||
substituteInPlace ''${rockspecFilename} \
|
||||
--replace 'lua ~> 5.3' 'lua >= 5.3, < 5.5'
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
||||
lmpfrlib = prev.lmpfrlib.overrideAttrs (oa: {
|
||||
externalDeps = [
|
||||
{ name = "GMP"; dep = gmp; }
|
||||
{ name = "MPFR"; dep = mpfr; }
|
||||
{
|
||||
name = "GMP";
|
||||
dep = gmp;
|
||||
}
|
||||
{
|
||||
name = "MPFR";
|
||||
dep = mpfr;
|
||||
}
|
||||
];
|
||||
unpackPhase = ''
|
||||
cp $src $(stripHash $src)
|
||||
@@ -292,7 +323,10 @@ in
|
||||
|
||||
lrexlib-pcre = prev.lrexlib-pcre.overrideAttrs (oa: {
|
||||
externalDeps = [
|
||||
{ name = "PCRE"; dep = pcre; }
|
||||
{
|
||||
name = "PCRE";
|
||||
dep = pcre;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
@@ -328,7 +362,7 @@ in
|
||||
'';
|
||||
});
|
||||
|
||||
lua-resty-jwt = prev.lua-resty-jwt.overrideAttrs(oa: {
|
||||
lua-resty-jwt = prev.lua-resty-jwt.overrideAttrs (oa: {
|
||||
src = fetchFromGitHub {
|
||||
owner = "cdbattags";
|
||||
repo = "lua-resty-jwt";
|
||||
@@ -342,7 +376,9 @@ in
|
||||
buildInputs = oa.buildInputs ++ [
|
||||
zlib.dev
|
||||
];
|
||||
meta = oa.meta // { broken = luaOlder "5.1" || luaAtLeast "5.4"; };
|
||||
meta = oa.meta // {
|
||||
broken = luaOlder "5.1" || luaAtLeast "5.4";
|
||||
};
|
||||
});
|
||||
|
||||
luadbi-mysql = prev.luadbi-mysql.overrideAttrs (oa: {
|
||||
@@ -367,7 +403,10 @@ in
|
||||
|
||||
luadbi-sqlite3 = prev.luadbi-sqlite3.overrideAttrs (oa: {
|
||||
externalDeps = [
|
||||
{ name = "SQLITE"; dep = sqlite; }
|
||||
{
|
||||
name = "SQLITE";
|
||||
dep = sqlite;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
@@ -376,14 +415,20 @@ in
|
||||
final.luasocket
|
||||
];
|
||||
externalDeps = [
|
||||
{ name = "EVENT"; dep = libevent; }
|
||||
{
|
||||
name = "EVENT";
|
||||
dep = libevent;
|
||||
}
|
||||
];
|
||||
meta.broken = luaOlder "5.1" || luaAtLeast "5.4";
|
||||
});
|
||||
|
||||
luaexpat = prev.luaexpat.overrideAttrs (_: {
|
||||
externalDeps = [
|
||||
{ name = "EXPAT"; dep = expat; }
|
||||
{
|
||||
name = "EXPAT";
|
||||
dep = expat;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
@@ -403,27 +448,45 @@ in
|
||||
|
||||
lualdap = prev.lualdap.overrideAttrs (_: {
|
||||
externalDeps = [
|
||||
{ name = "LDAP"; dep = openldap; }
|
||||
{
|
||||
name = "LDAP";
|
||||
dep = openldap;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
luaossl = prev.luaossl.overrideAttrs (_: {
|
||||
externalDeps = [
|
||||
{ name = "CRYPTO"; dep = openssl; }
|
||||
{ name = "OPENSSL"; dep = openssl; }
|
||||
{
|
||||
name = "CRYPTO";
|
||||
dep = openssl;
|
||||
}
|
||||
{
|
||||
name = "OPENSSL";
|
||||
dep = openssl;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
luaposix = prev.luaposix.overrideAttrs (_: {
|
||||
externalDeps = [
|
||||
{ name = "CRYPT"; dep = libxcrypt; }
|
||||
{
|
||||
name = "CRYPT";
|
||||
dep = libxcrypt;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
luaprompt = prev.luaprompt.overrideAttrs (oa: {
|
||||
externalDeps = [
|
||||
{ name = "READLINE"; dep = readline; }
|
||||
{ name = "HISTORY"; dep = readline; }
|
||||
{
|
||||
name = "READLINE";
|
||||
dep = readline;
|
||||
}
|
||||
{
|
||||
name = "HISTORY";
|
||||
dep = readline;
|
||||
}
|
||||
];
|
||||
|
||||
nativeBuildInputs = oa.nativeBuildInputs ++ [ installShellFiles ];
|
||||
@@ -436,11 +499,19 @@ in
|
||||
# As a nix user, use this derivation instead of "luarocks_bootstrap"
|
||||
luarocks = prev.luarocks.overrideAttrs (oa: {
|
||||
|
||||
nativeBuildInputs = oa.nativeBuildInputs ++ [ installShellFiles lua unzip ];
|
||||
nativeBuildInputs = oa.nativeBuildInputs ++ [
|
||||
installShellFiles
|
||||
lua
|
||||
unzip
|
||||
];
|
||||
# cmake is just to compile packages with "cmake" buildType, not luarocks itself
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
propagatedBuildInputs = [ zip unzip cmake ];
|
||||
propagatedBuildInputs = [
|
||||
zip
|
||||
unzip
|
||||
cmake
|
||||
];
|
||||
|
||||
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd luarocks \
|
||||
@@ -462,19 +533,28 @@ in
|
||||
|
||||
luasec = prev.luasec.overrideAttrs (oa: {
|
||||
externalDeps = [
|
||||
{ name = "OPENSSL"; dep = openssl; }
|
||||
{
|
||||
name = "OPENSSL";
|
||||
dep = openssl;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
luasql-sqlite3 = prev.luasql-sqlite3.overrideAttrs (oa: {
|
||||
externalDeps = [
|
||||
{ name = "SQLITE"; dep = sqlite; }
|
||||
{
|
||||
name = "SQLITE";
|
||||
dep = sqlite;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
luasystem = prev.luasystem.overrideAttrs (oa: lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||||
buildInputs = [ glibc.out ];
|
||||
});
|
||||
luasystem = prev.luasystem.overrideAttrs (
|
||||
oa:
|
||||
lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||||
buildInputs = [ glibc.out ];
|
||||
}
|
||||
);
|
||||
|
||||
luazip = prev.luazip.overrideAttrs (oa: {
|
||||
buildInputs = oa.buildInputs ++ [
|
||||
@@ -487,7 +567,7 @@ in
|
||||
# meta.broken = true;
|
||||
# });
|
||||
|
||||
lua-yajl = prev.lua-yajl.overrideAttrs (oa: {
|
||||
lua-yajl = prev.lua-yajl.overrideAttrs (oa: {
|
||||
buildInputs = oa.buildInputs ++ [
|
||||
yajl
|
||||
];
|
||||
@@ -495,7 +575,10 @@ in
|
||||
|
||||
luaunbound = prev.luaunbound.overrideAttrs (oa: {
|
||||
externalDeps = [
|
||||
{ name = "libunbound"; dep = unbound; }
|
||||
{
|
||||
name = "libunbound";
|
||||
dep = unbound;
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
@@ -510,7 +593,10 @@ in
|
||||
hash = "sha256-7mFn4dLgaxfAxtPFCc3VzcBx2HuywcZTYqCGTbaGS0k=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = oa.propagatedBuildInputs ++ [ cargo rustPlatform.cargoSetupHook ];
|
||||
propagatedBuildInputs = oa.propagatedBuildInputs ++ [
|
||||
cargo
|
||||
rustPlatform.cargoSetupHook
|
||||
];
|
||||
|
||||
# ld: symbol(s) not found for architecture arm64
|
||||
# clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
|
||||
@@ -527,7 +613,10 @@ in
|
||||
|
||||
luuid = prev.luuid.overrideAttrs (oa: {
|
||||
externalDeps = [
|
||||
{ name = "LIBUUID"; dep = libuuid; }
|
||||
{
|
||||
name = "LIBUUID";
|
||||
dep = libuuid;
|
||||
}
|
||||
];
|
||||
# Trivial patch to make it work in both 5.1 and 5.2. Basically just the
|
||||
# tiny diff between the two upstream versions placed behind an #if.
|
||||
@@ -538,7 +627,7 @@ in
|
||||
patches = [
|
||||
./luuid.patch
|
||||
];
|
||||
postConfigure = ''
|
||||
postConfigure = ''
|
||||
sed -Ei ''${rockspecFilename} -e 's|lua >= 5.2|lua >= 5.1,|'
|
||||
'';
|
||||
meta = oa.meta // {
|
||||
@@ -547,20 +636,12 @@ in
|
||||
};
|
||||
});
|
||||
|
||||
lz-n = prev.lz-n.overrideAttrs(oa: {
|
||||
lz-n = prev.lz-n.overrideAttrs (oa: {
|
||||
doCheck = lua.luaversion == "5.1";
|
||||
nativeCheckInputs = [ final.nlua final.busted ];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
export HOME=$(mktemp -d)
|
||||
busted --lua=nlua
|
||||
runHook postCheck
|
||||
'';
|
||||
});
|
||||
|
||||
lze = prev.lze.overrideAttrs(oa: {
|
||||
doCheck = lua.luaversion == "5.1";
|
||||
nativeCheckInputs = [ final.nlua final.busted ];
|
||||
nativeCheckInputs = [
|
||||
final.nlua
|
||||
final.busted
|
||||
];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
export HOME=$(mktemp -d)
|
||||
@@ -569,10 +650,26 @@ in
|
||||
'';
|
||||
});
|
||||
|
||||
neotest = prev.neotest.overrideAttrs(oa: {
|
||||
lze = prev.lze.overrideAttrs (oa: {
|
||||
doCheck = lua.luaversion == "5.1";
|
||||
nativeCheckInputs = [
|
||||
final.nlua
|
||||
final.busted
|
||||
];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
export HOME=$(mktemp -d)
|
||||
busted --lua=nlua
|
||||
runHook postCheck
|
||||
'';
|
||||
});
|
||||
|
||||
neotest = prev.neotest.overrideAttrs (oa: {
|
||||
doCheck = stdenv.hostPlatform.isLinux;
|
||||
nativeCheckInputs = oa.nativeCheckInputs ++ [
|
||||
final.nlua final.busted neovim-unwrapped
|
||||
final.nlua
|
||||
final.busted
|
||||
neovim-unwrapped
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
@@ -584,12 +681,15 @@ in
|
||||
-c "PlenaryBustedDirectory tests/ {sequential = true}"
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
'';
|
||||
});
|
||||
|
||||
haskell-tools-nvim = prev.haskell-tools-nvim.overrideAttrs(oa: {
|
||||
haskell-tools-nvim = prev.haskell-tools-nvim.overrideAttrs (oa: {
|
||||
doCheck = lua.luaversion == "5.1";
|
||||
nativeCheckInputs = [ final.nlua final.busted ];
|
||||
nativeCheckInputs = [
|
||||
final.nlua
|
||||
final.busted
|
||||
];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
export HOME=$(mktemp -d)
|
||||
@@ -608,7 +708,10 @@ in
|
||||
|
||||
nvim-nio = prev.nvim-nio.overrideAttrs (oa: {
|
||||
doCheck = lua.luaversion == "5.1";
|
||||
nativeCheckInputs = [ final.nlua final.busted ];
|
||||
nativeCheckInputs = [
|
||||
final.nlua
|
||||
final.busted
|
||||
];
|
||||
|
||||
# upstream uses PlenaryBusted which is a pain to setup
|
||||
checkPhase = ''
|
||||
@@ -665,10 +768,15 @@ in
|
||||
rm -rf deps/lua deps/libuv
|
||||
'';
|
||||
|
||||
buildInputs = [ libuv final.lua ];
|
||||
buildInputs = [
|
||||
libuv
|
||||
final.lua
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ pkg-config cmake ]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
cmake
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ fixDarwinDylibNames ];
|
||||
};
|
||||
|
||||
luv = prev.luv.overrideAttrs (oa: {
|
||||
@@ -678,7 +786,9 @@ in
|
||||
|
||||
# Use system libuv instead of building local and statically linking
|
||||
luarocksConfig = lib.recursiveUpdate oa.luarocksConfig {
|
||||
variables = { WITH_SHARED_LIBUV = "ON"; };
|
||||
variables = {
|
||||
WITH_SHARED_LIBUV = "ON";
|
||||
};
|
||||
};
|
||||
|
||||
# we unset the LUA_PATH since the hook erases the interpreter defaults (To fix)
|
||||
@@ -715,7 +825,7 @@ in
|
||||
});
|
||||
|
||||
mpack = prev.mpack.overrideAttrs (drv: {
|
||||
buildInputs = (drv.buildInputs or []) ++ [ libmpack ];
|
||||
buildInputs = (drv.buildInputs or [ ]) ++ [ libmpack ];
|
||||
env = {
|
||||
# the rockspec doesn't use the makefile so you may need to export more flags
|
||||
USE_SYSTEM_LUA = "yes";
|
||||
@@ -723,12 +833,12 @@ in
|
||||
};
|
||||
});
|
||||
|
||||
nlua = prev.nlua.overrideAttrs(oa: {
|
||||
nlua = prev.nlua.overrideAttrs (oa: {
|
||||
|
||||
# patchShebang removes the nvim in nlua's shebang so we hardcode one
|
||||
postFixup = ''
|
||||
sed -i -e "1 s|.*|#\!${coreutils}/bin/env -S ${neovim-unwrapped}/bin/nvim -l|" "$out/bin/nlua"
|
||||
'';
|
||||
'';
|
||||
dontPatchShebangs = true;
|
||||
});
|
||||
|
||||
@@ -749,68 +859,87 @@ in
|
||||
});
|
||||
|
||||
# upstream broken, can't be generated, so moved out from the generated set
|
||||
readline = final.callPackage({ buildLuarocksPackage, fetchurl, luaAtLeast, luaOlder, lua, luaposix }:
|
||||
buildLuarocksPackage ({
|
||||
pname = "readline";
|
||||
version = "3.2-0";
|
||||
knownRockspec = (fetchurl {
|
||||
url = "mirror://luarocks/readline-3.2-0.rockspec";
|
||||
sha256 = "1r0sgisxm4xd1r6i053iibxh30j7j3rcj4wwkd8rzkj8nln20z24";
|
||||
}).outPath;
|
||||
src = fetchurl {
|
||||
# the rockspec url doesn't work because 'www.' is not covered by the certificate so
|
||||
# I manually removed the 'www' prefix here
|
||||
url = "http://pjb.com.au/comp/lua/readline-3.2.tar.gz";
|
||||
sha256 = "1mk9algpsvyqwhnq7jlw4cgmfzj30l7n2r6ak4qxgdxgc39f48k4";
|
||||
};
|
||||
readline = final.callPackage (
|
||||
{
|
||||
buildLuarocksPackage,
|
||||
fetchurl,
|
||||
luaAtLeast,
|
||||
luaOlder,
|
||||
lua,
|
||||
luaposix,
|
||||
}:
|
||||
buildLuarocksPackage ({
|
||||
pname = "readline";
|
||||
version = "3.2-0";
|
||||
knownRockspec =
|
||||
(fetchurl {
|
||||
url = "mirror://luarocks/readline-3.2-0.rockspec";
|
||||
sha256 = "1r0sgisxm4xd1r6i053iibxh30j7j3rcj4wwkd8rzkj8nln20z24";
|
||||
}).outPath;
|
||||
src = fetchurl {
|
||||
# the rockspec url doesn't work because 'www.' is not covered by the certificate so
|
||||
# I manually removed the 'www' prefix here
|
||||
url = "http://pjb.com.au/comp/lua/readline-3.2.tar.gz";
|
||||
sha256 = "1mk9algpsvyqwhnq7jlw4cgmfzj30l7n2r6ak4qxgdxgc39f48k4";
|
||||
};
|
||||
|
||||
luarocksConfig.variables = rec {
|
||||
READLINE_INCDIR = "${readline.dev}/include";
|
||||
HISTORY_INCDIR = READLINE_INCDIR;
|
||||
};
|
||||
unpackCmd = ''
|
||||
unzip "$curSrc"
|
||||
tar xf *.tar.gz
|
||||
'';
|
||||
luarocksConfig.variables = rec {
|
||||
READLINE_INCDIR = "${readline.dev}/include";
|
||||
HISTORY_INCDIR = READLINE_INCDIR;
|
||||
};
|
||||
unpackCmd = ''
|
||||
unzip "$curSrc"
|
||||
tar xf *.tar.gz
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [
|
||||
luaposix
|
||||
readline.out
|
||||
];
|
||||
propagatedBuildInputs = [
|
||||
luaposix
|
||||
readline.out
|
||||
];
|
||||
|
||||
meta = {
|
||||
homepage = "https://pjb.com.au/comp/lua/readline.html";
|
||||
description = "Interface to the readline library";
|
||||
license.fullName = "MIT/X11";
|
||||
broken = (luaOlder "5.1") || (luaAtLeast "5.5");
|
||||
};
|
||||
})) {};
|
||||
meta = {
|
||||
homepage = "https://pjb.com.au/comp/lua/readline.html";
|
||||
description = "Interface to the readline library";
|
||||
license.fullName = "MIT/X11";
|
||||
broken = (luaOlder "5.1") || (luaAtLeast "5.5");
|
||||
};
|
||||
})
|
||||
) { };
|
||||
|
||||
rtp-nvim = prev.rtp-nvim.overrideAttrs(oa: {
|
||||
rtp-nvim = prev.rtp-nvim.overrideAttrs (oa: {
|
||||
doCheck = lua.luaversion == "5.1";
|
||||
nativeCheckInputs = [ final.nlua final.busted ];
|
||||
nativeCheckInputs = [
|
||||
final.nlua
|
||||
final.busted
|
||||
];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
export HOME=$(mktemp -d)
|
||||
busted --lua=nlua
|
||||
runHook postCheck
|
||||
'';
|
||||
'';
|
||||
});
|
||||
|
||||
rustaceanvim = prev.rustaceanvim.overrideAttrs(oa: {
|
||||
rustaceanvim = prev.rustaceanvim.overrideAttrs (oa: {
|
||||
doCheck = lua.luaversion == "5.1";
|
||||
nativeCheckInputs = [ final.nlua final.busted ];
|
||||
nativeCheckInputs = [
|
||||
final.nlua
|
||||
final.busted
|
||||
];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
export HOME=$(mktemp -d)
|
||||
busted --lua=nlua
|
||||
runHook postCheck
|
||||
'';
|
||||
'';
|
||||
});
|
||||
|
||||
sqlite = prev.sqlite.overrideAttrs (drv: {
|
||||
doCheck = stdenv.hostPlatform.isLinux;
|
||||
nativeCheckInputs = [ final.plenary-nvim neovim-unwrapped ];
|
||||
nativeCheckInputs = [
|
||||
final.plenary-nvim
|
||||
neovim-unwrapped
|
||||
];
|
||||
|
||||
# the plugin loads the library from either the LIBSQLITE env
|
||||
# or the vim.g.sqlite_clib_path variable.
|
||||
@@ -849,7 +978,10 @@ in
|
||||
src = oa.src;
|
||||
hash = "sha256-sO2q4cmkJc6T4iyJUWpBfr2ISycS1cXAIO0ibMfzyIE=";
|
||||
};
|
||||
nativeBuildInputs = oa.nativeBuildInputs ++ [ cargo rustPlatform.cargoSetupHook ];
|
||||
nativeBuildInputs = oa.nativeBuildInputs ++ [
|
||||
cargo
|
||||
rustPlatform.cargoSetupHook
|
||||
];
|
||||
});
|
||||
|
||||
tl = prev.tl.overrideAttrs ({
|
||||
@@ -865,8 +997,9 @@ in
|
||||
hash = "sha256-ow0zefFFrU91Q2PJww2jtd6nqUjwXUtfQzjkzl/AXuo=";
|
||||
};
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin
|
||||
(if lua.pkgs.isLuaJIT then "-lluajit-${lua.luaversion}" else "-llua");
|
||||
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin (
|
||||
if lua.pkgs.isLuaJIT then "-lluajit-${lua.luaversion}" else "-llua"
|
||||
);
|
||||
|
||||
nativeBuildInputs = oa.nativeBuildInputs ++ [
|
||||
cargo
|
||||
@@ -895,13 +1028,16 @@ in
|
||||
});
|
||||
|
||||
tree-sitter-norg = prev.tree-sitter-norg.overrideAttrs (oa: {
|
||||
propagatedBuildInputs = let
|
||||
# HACK: luarocks-nix puts rockspec build dependencies in the nativeBuildInputs,
|
||||
# but that doesn't seem to work
|
||||
lua = lib.head oa.propagatedBuildInputs;
|
||||
in oa.propagatedBuildInputs ++ [
|
||||
lua.pkgs.luarocks-build-treesitter-parser-cpp
|
||||
];
|
||||
propagatedBuildInputs =
|
||||
let
|
||||
# HACK: luarocks-nix puts rockspec build dependencies in the nativeBuildInputs,
|
||||
# but that doesn't seem to work
|
||||
lua = lib.head oa.propagatedBuildInputs;
|
||||
in
|
||||
oa.propagatedBuildInputs
|
||||
++ [
|
||||
lua.pkgs.luarocks-build-treesitter-parser-cpp
|
||||
];
|
||||
});
|
||||
|
||||
tree-sitter-orgmode = prev.tree-sitter-orgmode.overrideAttrs (oa: {
|
||||
@@ -933,7 +1069,6 @@ in
|
||||
'';
|
||||
});
|
||||
|
||||
|
||||
# aliases
|
||||
cjson = prev.lua-cjson;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user