diff options
Diffstat (limited to 'pkgs/applications/editors/neovim/gnvim/wrapper.nix')
-rw-r--r-- | pkgs/applications/editors/neovim/gnvim/wrapper.nix | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/applications/editors/neovim/gnvim/wrapper.nix b/pkgs/applications/editors/neovim/gnvim/wrapper.nix new file mode 100644 index 000000000000..e16fe8a8adc7 --- /dev/null +++ b/pkgs/applications/editors/neovim/gnvim/wrapper.nix @@ -0,0 +1,41 @@ +{ stdenv, gnvim-unwrapped, neovim, makeWrapper }: + +stdenv.mkDerivation { + pname = "gnvim"; + version = gnvim-unwrapped.version; + buildCommand = if stdenv.isDarwin then '' + mkdir -p $out/Applications + cp -r ${gnvim-unwrapped}/bin/gnvim.app $out/Applications + + chmod -R a+w "$out/Applications/gnvim.app/Contents/MacOS" + wrapProgram "$out/Applications/gnvim.app/Contents/MacOS/gnvim" \ + --prefix PATH : "${neovim}/bin" \ + --set GNVIM_RUNTIME_PATH "${gnvim-unwrapped}/share/gnvim/runtime" + '' else '' + makeWrapper '${gnvim-unwrapped}/bin/gnvim' "$out/bin/gnvim" \ + --prefix PATH : "${neovim}/bin" \ + --set GNVIM_RUNTIME_PATH "${gnvim-unwrapped}/share/gnvim/runtime" + + mkdir -p "$out/share" + ln -s '${gnvim-unwrapped}/share/icons' "$out/share/icons" + + # copy and fix .desktop file + cp -r '${gnvim-unwrapped}/share/applications' "$out/share/applications" + # Sed needs a writable directory to do inplace modifications + chmod u+rw "$out/share/applications" + for file in $out/share/applications/*.desktop; do + sed -e "s|Exec=.\\+gnvim\\>|Exec=$out/bin/gnvim|" -i "$file" + done + ''; + + preferLocalBuild = true; + + nativeBuildInputs = [ + makeWrapper + ]; + + passthru.unwrapped = gnvim-unwrapped; + + inherit (gnvim-unwrapped) meta; +} + |