about summary refs log tree commit diff
path: root/pkgs/games/fishfight/default.nix
blob: 422901fd986484da8baba9bd462e971ae33fd571 (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
{ lib
, rustPlatform
, fetchFromGitHub
, stdenv
, SDL2
, alsa-lib
, libGL
, libX11
, libXi
, AudioToolbox
, Cocoa
, CoreAudio
, OpenGL
}:

rustPlatform.buildRustPackage rec {
  pname = "fishfight";
  version = "0.3";

  src = fetchFromGitHub {
    owner = "fishfight";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-kLdk7zTICZ8iawNttTsWUVKGvh2zykXVsMqUyYoGrBs=";
  };

  # use system sdl2 instead of bundled sdl2
  cargoPatches = [ ./use-system-sdl2.patch ];

  cargoSha256 = "sha256-KQiqUzdsVMIjDmmreihekrrFoXeyNzd6ZbqApwH8B4Q=";

  buildInputs =  [
    SDL2
  ] ++ lib.optionals stdenv.isLinux [
    alsa-lib
    libGL
    libX11
    libXi
  ] ++ lib.optionals stdenv.isDarwin [
    AudioToolbox
    Cocoa
    CoreAudio
    OpenGL
  ];

  postPatch = ''
    substituteInPlace src/main.rs --replace ./assets $out/share/assets
  '';

  postInstall = ''
    mkdir $out/share
    cp -r assets $out/share
  '';

  meta = with lib; {
    description = "A tactical 2D shooter played by up to 4 players online or on a shared screen";
    homepage = "https://fishfight.org/";
    license = with licenses; [ mit /* or */ asl20 ];
    maintainers = with maintainers; [ figsoda ];
  };
}