about summary refs log tree commit diff
path: root/pkgs/by-name/lu
diff options
context:
space:
mode:
authorElian Doran <contact@eliandoran.me>2024-05-19 18:58:50 +0300
committerElian Doran <contact@eliandoran.me>2024-05-19 21:14:40 +0300
commit4aadb47dd5fe3309f2c3ee42b90af985f6ee6c46 (patch)
treea9454cb665d36056716808cffaf338c11a356d4e /pkgs/by-name/lu
parent57c78dc471ee9191c68c3937d96fe74004f3f2f2 (diff)
lunacy: fix "Unsupported file format" toast at startup
Diffstat (limited to 'pkgs/by-name/lu')
-rw-r--r--pkgs/by-name/lu/lunacy/package.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkgs/by-name/lu/lunacy/package.nix b/pkgs/by-name/lu/lunacy/package.nix
index 1e3ad510bf9ef..d39237e72aa86 100644
--- a/pkgs/by-name/lu/lunacy/package.nix
+++ b/pkgs/by-name/lu/lunacy/package.nix
@@ -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; {