about summary refs log tree commit diff
path: root/pkgs/games/katawa-shoujo
diff options
context:
space:
mode:
authorOPNA2608 <christoph.neidahl@gmail.com>2023-03-08 00:25:30 +0100
committerOPNA2608 <christoph.neidahl@gmail.com>2023-03-08 00:25:30 +0100
commit992b72241df579171f3d3a34c0338fda89c315aa (patch)
treec8da5b1df5683e74ff798c69fb4433a8cba98842 /pkgs/games/katawa-shoujo
parent3c4b76f46e2a7301b516df31d6024782eba9ba07 (diff)
katawa-shoujo: Add desktop file
unrpa works again so we can extract the icon from the game assets for it.
Diffstat (limited to 'pkgs/games/katawa-shoujo')
-rw-r--r--pkgs/games/katawa-shoujo/default.nix22
1 files changed, 20 insertions, 2 deletions
diff --git a/pkgs/games/katawa-shoujo/default.nix b/pkgs/games/katawa-shoujo/default.nix
index aeee79c5c029c..e549fbbcf9638 100644
--- a/pkgs/games/katawa-shoujo/default.nix
+++ b/pkgs/games/katawa-shoujo/default.nix
@@ -2,7 +2,9 @@
 , lib
 , fetchurl
 , autoPatchelfHook
+, copyDesktopItems
 , freetype
+, makeDesktopItem
 , makeWrapper
 , libGL
 , libGLU
@@ -21,6 +23,7 @@
 , SDL_image
 , SDL_ttf
 , undmg
+, unrpa
 , zlib
 }:
 
@@ -52,6 +55,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
     autoPatchelfHook
+    copyDesktopItems
+    unrpa
   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
     makeWrapper
     undmg
@@ -73,6 +78,15 @@ stdenv.mkDerivation rec {
     libGLU
   ];
 
+  desktopItems = [(makeDesktopItem rec {
+    name = "katawa-shoujo";
+    desktopName = "Katawa Shoujo";
+    comment = meta.description;
+    exec = name;
+    icon = name;
+    categories = [ "Game" ];
+  })];
+
   dontConfigure = true;
   dontBuild = true;
 
@@ -103,11 +117,15 @@ stdenv.mkDerivation rec {
     exec \$RENPY_GDB ${libDir}/'Katawa Shoujo' \$RENPY_PYARGS -EO ${dataDir}/'Katawa Shoujo'.py "\$@"
     EOF
 
-  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
+  '' + (if stdenv.hostPlatform.isDarwin then ''
     # No autoPatchelfHook on Darwin
     wrapProgram ${bin} \
       --prefix DYLD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs}
-  '' + ''
+  '' else ''
+    # Extract icon for xdg desktop file
+    unrpa ${dataDir}/game/data.rpa
+    install -Dm644 ui/icon.png $out/share/icons/hicolor/512x512/apps/katawa-shoujo.png
+  '') + ''
 
     # Delete binaries for wrong arch, autoPatchelfHook gets confused by them & less to keep in the store
     find "$(dirname ${libDir})" -mindepth 1 -maxdepth 1 \