diff options
Diffstat (limited to 'pkgs/applications/editors/neovim')
-rw-r--r-- | pkgs/applications/editors/neovim/default.nix | 31 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/applications/editors/neovim/neovim-gtk.nix | 0 | ||||
-rw-r--r-- | pkgs/applications/editors/neovim/neovim-qt.nix | 4 | ||||
-rw-r--r-- | pkgs/applications/editors/neovim/tests/default.nix | 2 | ||||
-rw-r--r-- | pkgs/applications/editors/neovim/wrapper.nix | 56 |
5 files changed, 67 insertions, 26 deletions
diff --git a/pkgs/applications/editors/neovim/default.nix b/pkgs/applications/editors/neovim/default.nix index 9bf6fb51bdf..e183799d853 100644 --- a/pkgs/applications/editors/neovim/default.nix +++ b/pkgs/applications/editors/neovim/default.nix @@ -7,6 +7,7 @@ , buildPackages , treesitter-parsers ? import ./treesitter-parsers.nix { inherit fetchurl; } , CoreServices +, fixDarwinDylibNames , glibcLocales ? null, procps ? null # now defaults to false because some tests can be flaky (clipboard etc), see @@ -16,8 +17,29 @@ }: let + nvim-lpeg-dylib = luapkgs: if stdenv.isDarwin + then (luapkgs.lpeg.overrideAttrs (oa: { + preConfigure = '' + # neovim wants clang .dylib + sed -i makefile -e "s/CC = gcc/CC = clang/" + sed -i makefile -e "s/-bundle/-dynamiclib/" + ''; + preBuild = '' + # there seems to be implicit calls to Makefile from luarocks, we need to + # add a stage to build our dylib + make macosx + mkdir -p $out/lib + mv lpeg.so $out/lib/lpeg.dylib + ''; + nativeBuildInputs = + oa.nativeBuildInputs + ++ ( + lib.optional stdenv.isDarwin fixDarwinDylibNames + ); + })) + else luapkgs.lpeg; requiredLuaPkgs = ps: (with ps; [ - lpeg + (nvim-lpeg-dylib ps) luabitop mpack ] ++ lib.optionals doCheck [ @@ -40,20 +62,21 @@ let deterministicStringIds = true; self = deterministicLuajit; }; - in deterministicLuajit.withPackages(ps: [ ps.mpack ps.lpeg ]) + in deterministicLuajit.withPackages(ps: [ ps.mpack (nvim-lpeg-dylib ps) ]) else lua.luaOnBuild; pyEnv = python3.withPackages(ps: with ps; [ pynvim msgpack ]); + in stdenv.mkDerivation rec { pname = "neovim-unwrapped"; - version = "0.9.2"; + version = "0.9.4"; src = fetchFromGitHub { owner = "neovim"; repo = "neovim"; rev = "v${version}"; - hash = "sha256-kKstlq1BzoBAy+gy9iL1auRViJ223cVpAt5X7pUWT1U="; + hash = "sha256-Lyo98cAs7Zhx23N4s4f3zpWFKYJMmXleWpt3wiVDQZo="; }; patches = [ diff --git a/pkgs/applications/editors/neovim/neovim-gtk.nix b/pkgs/applications/editors/neovim/neovim-gtk.nix index eebb980f85c..eebb980f85c 100755..100644 --- a/pkgs/applications/editors/neovim/neovim-gtk.nix +++ b/pkgs/applications/editors/neovim/neovim-gtk.nix diff --git a/pkgs/applications/editors/neovim/neovim-qt.nix b/pkgs/applications/editors/neovim/neovim-qt.nix index b9d0ab4ec23..a8483f0db34 100644 --- a/pkgs/applications/editors/neovim/neovim-qt.nix +++ b/pkgs/applications/editors/neovim/neovim-qt.nix @@ -2,13 +2,13 @@ mkDerivation rec { pname = "neovim-qt-unwrapped"; - version = "0.2.17"; + version = "0.2.18"; src = fetchFromGitHub { owner = "equalsraf"; repo = "neovim-qt"; rev = "v${version}"; - sha256 = "sha256-UJXaHENqau5EEe5c94pJuNxZU5rutJs642w9Cof8Sa4="; + sha256 = "sha256-BitFHHwL2aqBUpY/8eHaZIFvnDCeABC6w33Vmbx0z2g="; }; cmakeFlags = [ diff --git a/pkgs/applications/editors/neovim/tests/default.nix b/pkgs/applications/editors/neovim/tests/default.nix index f1c38d2915d..a7e0e4c7705 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 0fbb54df01a..d61a2fe5e5a 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 |