3
0
Fork 0
forked from mirrors/nixpkgs

katawa-shoujo: Add desktop file

unrpa works again so we can extract the icon from the game assets for it.
This commit is contained in:
OPNA2608 2023-03-08 00:25:30 +01:00
parent 3c4b76f46e
commit 992b72241d

View file

@ -2,7 +2,9 @@
, lib , lib
, fetchurl , fetchurl
, autoPatchelfHook , autoPatchelfHook
, copyDesktopItems
, freetype , freetype
, makeDesktopItem
, makeWrapper , makeWrapper
, libGL , libGL
, libGLU , libGLU
@ -21,6 +23,7 @@
, SDL_image , SDL_image
, SDL_ttf , SDL_ttf
, undmg , undmg
, unrpa
, zlib , zlib
}: }:
@ -52,6 +55,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
autoPatchelfHook autoPatchelfHook
copyDesktopItems
unrpa
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
makeWrapper makeWrapper
undmg undmg
@ -73,6 +78,15 @@ stdenv.mkDerivation rec {
libGLU libGLU
]; ];
desktopItems = [(makeDesktopItem rec {
name = "katawa-shoujo";
desktopName = "Katawa Shoujo";
comment = meta.description;
exec = name;
icon = name;
categories = [ "Game" ];
})];
dontConfigure = true; dontConfigure = true;
dontBuild = true; dontBuild = true;
@ -103,11 +117,15 @@ stdenv.mkDerivation rec {
exec \$RENPY_GDB ${libDir}/'Katawa Shoujo' \$RENPY_PYARGS -EO ${dataDir}/'Katawa Shoujo'.py "\$@" exec \$RENPY_GDB ${libDir}/'Katawa Shoujo' \$RENPY_PYARGS -EO ${dataDir}/'Katawa Shoujo'.py "\$@"
EOF EOF
'' + lib.optionalString stdenv.hostPlatform.isDarwin '' '' + (if stdenv.hostPlatform.isDarwin then ''
# No autoPatchelfHook on Darwin # No autoPatchelfHook on Darwin
wrapProgram ${bin} \ wrapProgram ${bin} \
--prefix DYLD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} --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 # Delete binaries for wrong arch, autoPatchelfHook gets confused by them & less to keep in the store
find "$(dirname ${libDir})" -mindepth 1 -maxdepth 1 \ find "$(dirname ${libDir})" -mindepth 1 -maxdepth 1 \