diff --git a/pkgs/games/quake2/yquake2/default.nix b/pkgs/games/quake2/yquake2/default.nix index 9a3597937d8c..b37c4f5e6a0e 100644 --- a/pkgs/games/quake2/yquake2/default.nix +++ b/pkgs/games/quake2/yquake2/default.nix @@ -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/"; diff --git a/pkgs/games/quake2/yquake2/games.nix b/pkgs/games/quake2/yquake2/games.nix index c78689971a63..aca5ffb5e3f5 100644 --- a/pkgs/games/quake2/yquake2/games.nix +++ b/pkgs/games/quake2/yquake2/games.nix @@ -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; { diff --git a/pkgs/games/quake2/yquake2/wrapper.nix b/pkgs/games/quake2/yquake2/wrapper.nix index 4850dff99dcd..fafc1d3eaebd 100644 --- a/pkgs/games/quake2/yquake2/wrapper.nix +++ b/pkgs/games/quake2/yquake2/wrapper.nix @@ -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;