summaryrefslogtreecommitdiffstats
path: root/pkgs/games/quake2/yquake2/games.nix
blob: 3d3f11032438b601e29cd0ea46e861054578000a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
  stdenv,
  lib,
  fetchFromGitHub,
}:

let
  games = {
    ctf = {
      id = "ctf";
      version = "1.07";
      description = "'Capture The Flag' for Yamagi Quake II";
      sha256 = "0i9bwhjvq6yhalrsbzjambh27fdzrzgswqz3jgfn9qw6k1kjvlin";
    };

    ground-zero = {
      id = "rogue";
      version = "2.07";
      description = "'Ground Zero' for Yamagi Quake II";
      sha256 = "1m2r4vgfdxpsi0lkf32liwf1433mdhhmjxiicjwzqjlkncjyfcb1";
    };

    the-reckoning = {
      id = "xatrix";
      version = "2.08";
      description = "'The Reckoning' for Yamagi Quake II";
      sha256 = "1wp9fg1q8nly2r9hh4394r1h4dxyni3lvdy7g419cz5s8hhn5msr";
    };
  };

  toDrv =
    title: data:
    stdenv.mkDerivation rec {
      inherit (data)
        id
        version
        description
        sha256
        ;
      inherit title;

      pname = "yquake2-${title}";

      src = fetchFromGitHub {
        inherit sha256;
        owner = "yquake2";
        repo = data.id;
        rev = "${lib.toUpper id}_${builtins.replaceStrings [ "." ] [ "_" ] version}";
      };

      env =
        # Uses `false` and `true` as enum constants, which are keywords in C23 (GCC 15 default)
        lib.optionalAttrs stdenv.cc.isGNU {
          NIX_CFLAGS_COMPILE = "-std=gnu17";
        };

      installPhase = ''
        runHook preInstall
        mkdir -p $out/lib/yquake2/${id}
        cp release/* $out/lib/yquake2/${id}
        runHook postInstall
      '';

      meta = {
        inherit (data) description;
        homepage = "https://www.yamagi.org/quake2/";
        license = lib.licenses.unfree;
        platforms = lib.platforms.unix;
        maintainers = with lib.maintainers; [ tadfisher ];
      };
    };

in
lib.mapAttrs toDrv games