1 { stdenv, lib, fetchFromGitHub, buildEnv, makeWrapper
3 , openalSupport ? true, openal
8 mkFlag = b: if b then "yes" else "no";
10 games = import ./games.nix { inherit stdenv lib fetchFromGitHub; };
12 wrapper = import ./wrapper.nix { inherit stdenv lib buildEnv makeWrapper yquake2; };
14 yquake2 = stdenv.mkDerivation rec {
18 src = fetchFromGitHub {
21 rev = "QUAKE2_${builtins.replaceStrings ["."] ["_"] version}";
22 sha256 = "sha256-/BbMR/ZPjHbKzQ+I1+Vgh3/zenLjW3TnmrKhKPR6Gdk=";
26 substituteInPlace src/client/curl/qcurl.c \
27 --replace "\"libcurl.so.3\", \"libcurl.so.4\"" "\"${curl.out}/lib/libcurl.so\", \"libcurl.so.3\", \"libcurl.so.4\""
28 '' + lib.optionalString (openalSupport && !stdenv.isDarwin) ''
29 substituteInPlace Makefile \
30 --replace "\"libopenal.so.1\"" "\"${openal}/lib/libopenal.so.1\""
33 buildInputs = [ SDL2 libGL curl ]
34 ++ lib.optionals stdenv.isDarwin [ Cocoa OpenAL ]
35 ++ lib.optional openalSupport openal;
38 "WITH_OPENAL=${mkFlag openalSupport}"
40 "WITH_SYSTEMDIR=$\{out}/share/games/quake2"
43 enableParallelBuilding = true;
46 # Yamagi Quake II expects all binaries (executables and libs) to be in the
48 mkdir -p $out/bin $out/lib/yquake2 $out/share/games/quake2/baseq2
49 cp -r release/* $out/lib/yquake2
50 ln -s $out/lib/yquake2/quake2 $out/bin/yquake2
51 ln -s $out/lib/yquake2/q2ded $out/bin/yq2ded
52 cp $src/stuff/yq2.cfg $out/share/games/quake2/baseq2
56 description = "Yamagi Quake II client";
57 homepage = "https://www.yamagi.org/quake2/";
58 license = licenses.gpl2;
59 platforms = platforms.unix;
60 maintainers = with maintainers; [ tadfisher ];
67 yquake2-ctf = wrapper {
68 games = [ games.ctf ];
70 inherit (games.ctf) description;
73 yquake2-ground-zero = wrapper {
74 games = [ games.ground-zero ];
75 name = "yquake2-ground-zero";
76 inherit (games.ground-zero) description;
79 yquake2-the-reckoning = wrapper {
80 games = [ games.the-reckoning ];
81 name = "yquake2-the-reckoning";
82 inherit (games.the-reckoning) description;
85 yquake2-all-games = wrapper {
86 games = lib.attrValues games;
87 name = "yquake2-all-games";
88 description = "Yamagi Quake II with all add-on games";