1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 19:51:17 +00:00

lunacy: fix "Unsupported file format" toast at startup

This commit is contained in:
Elian Doran 2024-05-19 18:58:50 +03:00
parent 57c78dc471
commit 4aadb47dd5
No known key found for this signature in database

View file

@ -14,6 +14,7 @@
, libXcursor
, openssl
, imagemagick
, makeWrapper
}:
stdenv.mkDerivation (finalAttrs: {
@ -47,6 +48,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
dpkg
autoPatchelfHook
makeWrapper
];
# adds to the RPATHS of all shared objects (exe and libs)
@ -82,22 +84,22 @@ stdenv.mkDerivation (finalAttrs: {
# Prepare the desktop icon, the upstream icon is 200x200 but the hicolor theme does not
# support this resolution. Nearest sizes are 192x192 and 256x256.
${imagemagick}/bin/convert "opt/icons8/lunacy/Assets/LunacyLogo.png" -resize 192x192 lunacy.png
install -D lunacy.png "$out/share/icons/hicolor/192x192/apps/${finalAttrs.pname}.png"
install -D lunacy.png "$out/share/icons/hicolor/192x192/apps/lunacy.png"
runHook postInstall
'';
postInstall = ''
substituteInPlace $out/share/applications/lunacy.desktop \
--replace "Exec=/opt/icons8/lunacy/Lunacy" "Exec=${finalAttrs.pname}" \
--replace "Icon=/opt/icons8/lunacy/Assets/LunacyLogo.png" "Icon=${finalAttrs.pname}"
--replace "Exec=/opt/icons8/lunacy/Lunacy" "Exec=lunacy" \
--replace "Icon=/opt/icons8/lunacy/Assets/LunacyLogo.png" "Icon=lunacy"
'';
postFixup = ''
mkdir $out/bin
# Fixes runtime error regarding missing libSkiaSharp.so (which is in the same directory as the binary).
ln -s "$out/lib/lunacy/Lunacy" "$out/bin/${finalAttrs.pname}"
# The wrapper is needed instead of a symlink to prevent a random "Unsupported file format" when running the app.
makeWrapper "$out/lib/lunacy/Lunacy" "$out/bin/lunacy"
'';
meta = with lib; {