summary refs log tree commit diff
path: root/pkgs/games/sauerbraten/default.nix
blob: e2365f9ad2de1b0167f45da128e3dce6b0bd1b2c (plain) (blame)
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
75
76
77
78
79
{ lib
, stdenv
, fetchzip
, SDL2
, SDL2_image
, SDL2_mixer
, zlib
, makeWrapper
, copyDesktopItems
, makeDesktopItem
}:

stdenv.mkDerivation rec {
  pname = "sauerbraten";
  version = "2020-12-27";

  src = fetchzip {
    url = "mirror://sourceforge/sauerbraten/sauerbraten_${builtins.replaceStrings [ "-" ] [ "_" ] version}_linux.tar.bz2";
    sha256 = "0llknzj23vx6f3y452by9c7wlhzclyq4bqi22qd52m3l916z2mn5";
  };

  nativeBuildInputs = [
    makeWrapper
    copyDesktopItems
  ];

  buildInputs = [
    SDL2
    SDL2_mixer
    SDL2_image
    zlib
  ];

  sourceRoot = "${src.name}/src";

  enableParallelBuilding = true;

  desktopItems = [
    (makeDesktopItem {
      name = "sauerbraten";
      exec = "sauerbraten_client %u";
      icon = "sauerbraten";
      desktopName = "Sauerbraten";
      comment = "FPS that uses an improved version of the Cube engine";
      categories = [ "Application" "Game" "ActionGame" ];
    })
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/share/icon/ $out/share/sauerbraten $out/share/doc/sauerbraten
    cp -r "../docs/"* $out/share/doc/sauerbraten/
    cp sauer_client sauer_server $out/share/sauerbraten/
    cp -r ../packages ../data $out/share/sauerbraten/
    ln -s $out/share/sauerbraten/cube.png $out/share/icon/sauerbraten.png

    makeWrapper $out/share/sauerbraten/sauer_server $out/bin/sauerbraten_server \
      --chdir "$out/share/sauerbraten"
    makeWrapper $out/share/sauerbraten/sauer_client $out/bin/sauerbraten_client \
      --chdir "$out/share/sauerbraten" \
      --add-flags "-q\''${HOME}/.config/sauerbraten"

    runHook postInstall
  '';

  meta = with lib; {
    description = "A free multiplayer & singleplayer first person shooter, the successor of the Cube FPS";
    homepage = "http://sauerbraten.org";
    maintainers = with maintainers; [ raskin ajs124 ];
    mainProgram = "sauerbraten_client";
    hydraPlatforms =
      # raskin: tested amd64-linux;
      # not setting platforms because it is 0.5+ GiB of game data
      [ ];
    license = "freeware"; # as an aggregate - data files have different licenses code is under zlib license
    platforms = platforms.linux;
  };
}