mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-23 22:23:15 +00:00
e0f258f596
See db236e588d
"steam: Do $PATH lookup in steam.desktop [...]".
tl;dr: Otherwise widget/panel/desktop icons in DEs like KDE break.
Simply stop adding the full derivation path for neovim and stick with
how upstream uses no path at all.
While here, take care of gnvim.desktop as well by adjusting the sed(1)
expression (and simplifying it in one go); I do not use gnvim.desktop
but built it and confirmed the resulting files to contain no full paths
any longer.
40 lines
1.2 KiB
Nix
40 lines
1.2 KiB
Nix
{ 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"
|
|
sed -e "s|Exec=.\\+gnvim\\>|Exec=gnvim|" -i $out/share/applications/*.desktop
|
|
'';
|
|
|
|
preferLocalBuild = true;
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
];
|
|
|
|
passthru.unwrapped = gnvim-unwrapped;
|
|
|
|
inherit (gnvim-unwrapped) meta;
|
|
}
|
|
|