2021-09-23 02:09:18 +01:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, stdenv
|
2021-12-12 04:07:02 +00:00
|
|
|
, SDL2
|
2021-09-23 02:09:18 +01:00
|
|
|
, alsa-lib
|
|
|
|
, libGL
|
|
|
|
, libX11
|
|
|
|
, libXi
|
|
|
|
, AudioToolbox
|
|
|
|
, Cocoa
|
|
|
|
, CoreAudio
|
|
|
|
, OpenGL
|
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "fishfight";
|
2021-12-12 04:07:02 +00:00
|
|
|
version = "0.3";
|
2021-09-23 02:09:18 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "fishfight";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-12-12 04:07:02 +00:00
|
|
|
sha256 = "sha256-kLdk7zTICZ8iawNttTsWUVKGvh2zykXVsMqUyYoGrBs=";
|
2021-09-23 02:09:18 +01:00
|
|
|
};
|
|
|
|
|
2021-12-12 04:07:02 +00:00
|
|
|
# use system sdl2 instead of bundled sdl2
|
|
|
|
cargoPatches = [ ./use-system-sdl2.patch ];
|
2021-09-23 02:09:18 +01:00
|
|
|
|
2021-12-12 04:07:02 +00:00
|
|
|
cargoSha256 = "sha256-KQiqUzdsVMIjDmmreihekrrFoXeyNzd6ZbqApwH8B4Q=";
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2021-09-23 02:09:18 +01:00
|
|
|
alsa-lib
|
|
|
|
libGL
|
|
|
|
libX11
|
|
|
|
libXi
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
AudioToolbox
|
|
|
|
Cocoa
|
|
|
|
CoreAudio
|
|
|
|
OpenGL
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2021-12-12 04:07:02 +00:00
|
|
|
substituteInPlace src/main.rs --replace ./assets $out/share/assets
|
2021-09-23 02:09:18 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|