Merge pull request #286107 from Stunkymonkey/yquake2-desktop-item

yquake2*: add desktop item
This commit is contained in:
Felix Bühler 2024-04-08 20:21:11 +02:00 committed by GitHub
commit e5c0436619
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 8 deletions

View file

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, buildEnv, makeWrapper { stdenv, lib, fetchFromGitHub, buildEnv, makeWrapper, copyDesktopItems, makeDesktopItem
, SDL2, libGL, curl , SDL2, libGL, curl
, openalSupport ? true, openal , openalSupport ? true, openal
, Cocoa, OpenAL , Cocoa, OpenAL
@ -9,7 +9,7 @@ let
games = import ./games.nix { inherit stdenv lib fetchFromGitHub; }; games = import ./games.nix { inherit stdenv lib fetchFromGitHub; };
wrapper = import ./wrapper.nix { inherit stdenv lib buildEnv makeWrapper yquake2; }; wrapper = import ./wrapper.nix { inherit stdenv lib buildEnv makeWrapper yquake2 copyDesktopItems makeDesktopItem; };
yquake2 = stdenv.mkDerivation rec { yquake2 = stdenv.mkDerivation rec {
pname = "yquake2"; pname = "yquake2";
@ -40,9 +40,12 @@ let
"WITH_SYSTEMDIR=$\{out}/share/games/quake2" "WITH_SYSTEMDIR=$\{out}/share/games/quake2"
]; ];
nativeBuildInputs = [ copyDesktopItems ];
enableParallelBuilding = true; enableParallelBuilding = true;
installPhase = '' installPhase = ''
runHook preInstall
# Yamagi Quake II expects all binaries (executables and libs) to be in the # Yamagi Quake II expects all binaries (executables and libs) to be in the
# same directory. # same directory.
mkdir -p $out/bin $out/lib/yquake2 $out/share/games/quake2/baseq2 mkdir -p $out/bin $out/lib/yquake2 $out/share/games/quake2/baseq2
@ -50,8 +53,19 @@ let
ln -s $out/lib/yquake2/quake2 $out/bin/yquake2 ln -s $out/lib/yquake2/quake2 $out/bin/yquake2
ln -s $out/lib/yquake2/q2ded $out/bin/yq2ded ln -s $out/lib/yquake2/q2ded $out/bin/yq2ded
cp $src/stuff/yq2.cfg $out/share/games/quake2/baseq2 cp $src/stuff/yq2.cfg $out/share/games/quake2/baseq2
install -Dm644 stuff/icon/Quake2.png $out/share/pixmaps/yamagi-quake2.png;
runHook postInstall
''; '';
desktopItems = [ (makeDesktopItem {
name = "yquake2";
exec = "yquake2";
icon = "yamagi-quake2";
desktopName = "yquake2";
comment = "Yamagi Quake II client";
categories = [ "Game" "Shooter" ];
})];
meta = with lib; { meta = with lib; {
description = "Yamagi Quake II client"; description = "Yamagi Quake II client";
homepage = "https://www.yamagi.org/quake2/"; homepage = "https://www.yamagi.org/quake2/";

View file

@ -38,8 +38,10 @@ let
}; };
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out/lib/yquake2/${id} mkdir -p $out/lib/yquake2/${id}
cp release/* $out/lib/yquake2/${id} cp release/* $out/lib/yquake2/${id}
runHook postInstall
''; '';
meta = with lib; { meta = with lib; {

View file

@ -1,4 +1,4 @@
{ stdenv, lib, buildEnv, makeWrapper, yquake2 }: { stdenv, lib, buildEnv, makeWrapper, yquake2, copyDesktopItems, makeDesktopItem }:
{ games { games
, name , name
@ -11,19 +11,38 @@ let
paths = [ yquake2 ] ++ games; paths = [ yquake2 ] ++ games;
}; };
in stdenv.mkDerivation { in
name = "${name}-${lib.getVersion yquake2}"; stdenv.mkDerivation {
pname = name;
version = lib.getVersion yquake2;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper copyDesktopItems ];
buildCommand = '' dontUnpack = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
'' + lib.concatMapStringsSep "\n" (game: '' '' + lib.concatMapStringsSep "\n" (game: ''
makeWrapper ${env}/bin/yquake2 $out/bin/yquake2-${game.title} \ makeWrapper ${env}/bin/yquake2 $out/bin/yquake2-${game.title} \
--add-flags "+set game ${game.id}" --add-flags "+set game ${game.id}"
makeWrapper ${env}/bin/yq2ded $out/bin/yq2ded-${game.title} \ makeWrapper ${env}/bin/yq2ded $out/bin/yq2ded-${game.title} \
--add-flags "+set game ${game.id}" --add-flags "+set game ${game.id}"
'') games; '') games + ''
install -Dm644 ${yquake2}/share/pixmaps/yamagi-quake2.png $out/share/pixmaps/yamagi-quake2.png;
runHook postInstall
'';
desktopItems = map
(game: makeDesktopItem ({
name = game.id;
exec = game.title;
icon = "yamagi-quake2";
desktopName = game.id;
comment = game.description;
categories = [ "Game" "Shooter" ];
}))
games;
meta = { meta = {
inherit description; inherit description;