diff options
author | Vladimír Čunát <v@cunat.cz> | 2023-10-26 10:36:50 +0200 |
---|---|---|
committer | Vladimír Čunát <v@cunat.cz> | 2023-10-26 10:36:50 +0200 |
commit | d811555465785e76fc06872f4bb14d4dd1dfed8c (patch) | |
tree | 91db30ffe3553dcd7c9766c4163687f7b951dd16 /pkgs/applications/editors/neovim | |
parent | 7054a80f3b8061bd532e407f46f60e484a5e9a9c (diff) | |
parent | 0f8647b0c2bce447f8ce27428de242727104ffb0 (diff) | |
download | nixlib-d811555465785e76fc06872f4bb14d4dd1dfed8c.tar nixlib-d811555465785e76fc06872f4bb14d4dd1dfed8c.tar.gz nixlib-d811555465785e76fc06872f4bb14d4dd1dfed8c.tar.bz2 nixlib-d811555465785e76fc06872f4bb14d4dd1dfed8c.tar.lz nixlib-d811555465785e76fc06872f4bb14d4dd1dfed8c.tar.xz nixlib-d811555465785e76fc06872f4bb14d4dd1dfed8c.tar.zst nixlib-d811555465785e76fc06872f4bb14d4dd1dfed8c.zip |
Merge branch 'staging' into staging-next
Diffstat (limited to 'pkgs/applications/editors/neovim')
-rw-r--r-- | pkgs/applications/editors/neovim/tests/default.nix | 2 | ||||
-rw-r--r-- | pkgs/applications/editors/neovim/wrapper.nix | 56 |
2 files changed, 38 insertions, 20 deletions
diff --git a/pkgs/applications/editors/neovim/tests/default.nix b/pkgs/applications/editors/neovim/tests/default.nix index f1c38d2915dc..a7e0e4c77057 100644 --- a/pkgs/applications/editors/neovim/tests/default.nix +++ b/pkgs/applications/editors/neovim/tests/default.nix @@ -212,7 +212,7 @@ rec { # having no RC generated should autodisable init.vim wrapping nvim_autowrap = runTest nvim_via_override '' - ! grep "-u" ${nvimShouldntWrap}/bin/nvim + ! grep ${nvimShouldntWrap}/bin/nvim ''; diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix index 0fbb54df01ac..d61a2fe5e5a8 100644 --- a/pkgs/applications/editors/neovim/wrapper.nix +++ b/pkgs/applications/editors/neovim/wrapper.nix @@ -7,8 +7,10 @@ , neovimUtils , vimUtils , perl +, lndir }: -neovim: + +neovim-unwrapped: let wrapper = { @@ -62,7 +64,7 @@ let # wrapper with most arguments we need, excluding those that cause problems to # generate rplugin.vim, but still required for the final wrapper. finalMakeWrapperArgs = - [ "${neovim}/bin/nvim" "${placeholder "out"}/bin/nvim" ] + [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim" ] ++ [ "--set" "NVIM_SYSTEM_RPLUGIN_MANIFEST" "${placeholder "out"}/rplugin.vim" ] ++ lib.optionals wrapRc [ "--add-flags" "-u ${writeText "init.vim" neovimRcContent}" ] ++ commonWrapperArgs @@ -72,36 +74,45 @@ let in assert withPython2 -> throw "Python2 support has been removed from the neovim wrapper, please remove withPython2 and python2Env."; - symlinkJoin { - name = "neovim-${lib.getVersion neovim}${extraName}"; + stdenv.mkDerivation (finalAttrs: { + name = "neovim-${lib.getVersion neovim-unwrapped}${extraName}"; + + __structuredAttrs = true; + dontUnpack = true; + inherit viAlias vimAlias withNodeJs withPython3 withPerl; + inherit wrapRc providerLuaRc packpathDirs; + inherit python3Env rubyEnv; + withRuby = rubyEnv != null; + inherit wrapperArgs; + # Remove the symlinks created by symlinkJoin which we need to perform # extra actions upon postBuild = lib.optionalString stdenv.isLinux '' rm $out/share/applications/nvim.desktop - substitute ${neovim}/share/applications/nvim.desktop $out/share/applications/nvim.desktop \ + substitute ${neovim-unwrapped}/share/applications/nvim.desktop $out/share/applications/nvim.desktop \ --replace 'Name=Neovim' 'Name=Neovim wrapper' '' - + lib.optionalString withPython3 '' + + lib.optionalString finalAttrs.withPython3 '' makeWrapper ${python3Env.interpreter} $out/bin/nvim-python3 --unset PYTHONPATH '' - + lib.optionalString (rubyEnv != null) '' - ln -s ${rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby + + lib.optionalString (finalAttrs.rubyEnv != null) '' + ln -s ${finalAttrs.rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby '' - + lib.optionalString withNodeJs '' + + lib.optionalString finalAttrs.withNodeJs '' ln -s ${nodePackages.neovim}/bin/neovim-node-host $out/bin/nvim-node '' - + lib.optionalString withPerl '' + + lib.optionalString finalAttrs.withPerl '' ln -s ${perlEnv}/bin/perl $out/bin/nvim-perl '' - + lib.optionalString vimAlias '' + + lib.optionalString finalAttrs.vimAlias '' ln -s $out/bin/nvim $out/bin/vim '' - + lib.optionalString viAlias '' + + lib.optionalString finalAttrs.viAlias '' ln -s $out/bin/nvim $out/bin/vi '' + lib.optionalString (manifestRc != null) (let manifestWrapperArgs = - [ "${neovim}/bin/nvim" "${placeholder "out"}/bin/nvim-wrapper" ] ++ commonWrapperArgs; + [ "${neovim-unwrapped}/bin/nvim" "${placeholder "out"}/bin/nvim-wrapper" ] ++ commonWrapperArgs; in '' echo "Generating remote plugin manifest" export NVIM_RPLUGIN_MANIFEST=$out/rplugin.vim @@ -139,26 +150,33 @@ let makeWrapper ${lib.escapeShellArgs finalMakeWrapperArgs} ${wrapperArgsStr} ''; - paths = [ neovim ]; + buildPhase = '' + runHook preBuild + mkdir -p $out + for i in ${neovim-unwrapped}; do + lndir -silent $i $out + done + runHook postBuild + ''; preferLocalBuild = true; - nativeBuildInputs = [ makeWrapper ]; + nativeBuildInputs = [ makeWrapper lndir ]; passthru = { inherit providerLuaRc packpathDirs; - unwrapped = neovim; + unwrapped = neovim-unwrapped; initRc = neovimRcContent; tests = callPackage ./tests { }; }; - meta = neovim.meta // { + meta = neovim-unwrapped.meta // { # To prevent builds on hydra hydraPlatforms = []; # prefer wrapper over the package - priority = (neovim.meta.priority or 0) - 1; + priority = (neovim-unwrapped.meta.priority or 0) - 1; }; - }; + }); in lib.makeOverridable wrapper |