yquake2: add desktop item

This commit is contained in:
Felix Buehler 2024-02-03 18:13:52 +01:00
parent 2de2b92916
commit b390d53ee8
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
, openalSupport ? true, openal
, Cocoa, OpenAL
@ -9,7 +9,7 @@ let
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 {
pname = "yquake2";
@ -40,9 +40,12 @@ let
"WITH_SYSTEMDIR=$\{out}/share/games/quake2"
];
nativeBuildInputs = [ copyDesktopItems ];
enableParallelBuilding = true;
installPhase = ''
runHook preInstall
# Yamagi Quake II expects all binaries (executables and libs) to be in the
# same directory.
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/q2ded $out/bin/yq2ded
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; {
description = "Yamagi Quake II client";
homepage = "https://www.yamagi.org/quake2/";

View File

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

View File

@ -1,4 +1,4 @@
{ stdenv, lib, buildEnv, makeWrapper, yquake2 }:
{ stdenv, lib, buildEnv, makeWrapper, yquake2, copyDesktopItems, makeDesktopItem }:
{ games
, name
@ -11,19 +11,38 @@ let
paths = [ yquake2 ] ++ games;
};
in stdenv.mkDerivation {
name = "${name}-${lib.getVersion yquake2}";
in
stdenv.mkDerivation {
pname = name;
version = lib.getVersion yquake2;
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ makeWrapper copyDesktopItems ];
buildCommand = ''
dontUnpack = true;
installPhase = ''
runHook preInstall
mkdir -p $out/bin
'' + lib.concatMapStringsSep "\n" (game: ''
makeWrapper ${env}/bin/yquake2 $out/bin/yquake2-${game.title} \
--add-flags "+set game ${game.id}"
makeWrapper ${env}/bin/yq2ded $out/bin/yq2ded-${game.title} \
--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 = {
inherit description;