Skip to content

Commit 992b722

Browse files
committed
katawa-shoujo: Add desktop file
unrpa works again so we can extract the icon from the game assets for it.
1 parent 3c4b76f commit 992b722

1 file changed

Lines changed: 20 additions & 2 deletions

File tree

pkgs/games/katawa-shoujo/default.nix

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
, lib
33
, fetchurl
44
, autoPatchelfHook
5+
, copyDesktopItems
56
, freetype
7+
, makeDesktopItem
68
, makeWrapper
79
, libGL
810
, libGLU
@@ -21,6 +23,7 @@
2123
, SDL_image
2224
, SDL_ttf
2325
, undmg
26+
, unrpa
2427
, zlib
2528
}:
2629

@@ -52,6 +55,8 @@ stdenv.mkDerivation rec {
5255

5356
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
5457
autoPatchelfHook
58+
copyDesktopItems
59+
unrpa
5560
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
5661
makeWrapper
5762
undmg
@@ -73,6 +78,15 @@ stdenv.mkDerivation rec {
7378
libGLU
7479
];
7580

81+
desktopItems = [(makeDesktopItem rec {
82+
name = "katawa-shoujo";
83+
desktopName = "Katawa Shoujo";
84+
comment = meta.description;
85+
exec = name;
86+
icon = name;
87+
categories = [ "Game" ];
88+
})];
89+
7690
dontConfigure = true;
7791
dontBuild = true;
7892

@@ -103,11 +117,15 @@ stdenv.mkDerivation rec {
103117
exec \$RENPY_GDB ${libDir}/'Katawa Shoujo' \$RENPY_PYARGS -EO ${dataDir}/'Katawa Shoujo'.py "\$@"
104118
EOF
105119
106-
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
120+
'' + (if stdenv.hostPlatform.isDarwin then ''
107121
# No autoPatchelfHook on Darwin
108122
wrapProgram ${bin} \
109123
--prefix DYLD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs}
110-
'' + ''
124+
'' else ''
125+
# Extract icon for xdg desktop file
126+
unrpa ${dataDir}/game/data.rpa
127+
install -Dm644 ui/icon.png $out/share/icons/hicolor/512x512/apps/katawa-shoujo.png
128+
'') + ''
111129
112130
# Delete binaries for wrong arch, autoPatchelfHook gets confused by them & less to keep in the store
113131
find "$(dirname ${libDir})" -mindepth 1 -maxdepth 1 \

0 commit comments

Comments
 (0)