summary refs log tree commit diff
path: root/pkgs/games/fishfight/default.nix
blob: 9e5bbde8cf72f71eff7a6b9f3985a104666d68e2 (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
{ lib
, rustPlatform
, fetchFromGitHub
, stdenv
, pkg-config
, alsa-lib
, libGL
, libX11
, libXi
, udev
, Cocoa
, OpenGL
}:

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

  src = fetchFromGitHub {
    owner = "fishfight";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-q1Hh4P/huoFuW/+Mb9yKUMKaky1RshGpjrObBHRCk+8=";
  };

  cargoSha256 = "sha256-PEGK95eXIHv2sxSwUU4345KtxDyRJn/+aEiJIDmkq6Y=";

  nativeBuildInputs = lib.optionals stdenv.isLinux [
    pkg-config
  ];

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

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

  postInstall = ''
    mkdir $out/share
    cp -r assets mods $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 ];
  };
}