1{ lib
2, rustPlatform
3, fetchFromGitHub
4, makeWrapper
5, pkg-config
6, zstd
7, stdenv
8, alsa-lib
9, libxkbcommon
10, udev
11, vulkan-loader
12, wayland
13, xorg
14, darwin
15}:
16
17rustPlatform.buildRustPackage rec {
18 pname = "jumpy";
19 version = "0.8.0";
20
21 src = fetchFromGitHub {
22 owner = "fishfolk";
23 repo = pname;
24 rev = "v${version}";
25 sha256 = "sha256-ggePJH2kKJ17aOWRKUnLyolIdSzlc6Axf5Iw74iFfek=";
26 };
27
28 cargoLock = {
29 lockFile = ./Cargo.lock;
30 outputHashes = {
31 "bevy_egui-0.21.0" = "sha256-hu55tZQppw1NajwqIsYsw6de0IAwQwgra3D9OFzSSLc=";
32 "bones_asset-0.3.0" = "sha256-1UeOXW6O/gMQBBUnHxRreJgmiUTPC5SJB+uLn9V8aa4=";
33 "kira-0.8.5" = "sha256-z4R5aIaoRQQprL6JsVrFI69rwTOsW5OH01+jORS+hBQ=";
34 };
35 };
36
37 nativeBuildInputs = [
38 makeWrapper
39 pkg-config
40 ];
41
42 buildInputs = [
43 zstd
44 ] ++ lib.optionals stdenv.isLinux [
45 alsa-lib
46 libxkbcommon
47 udev
48 vulkan-loader
49 wayland
50 xorg.libX11
51 xorg.libXcursor
52 xorg.libXi
53 xorg.libXrandr
54 ] ++ lib.optionals stdenv.isDarwin [
55 darwin.apple_sdk_11_0.frameworks.Cocoa
56 rustPlatform.bindgenHook
57 ];
58
59 cargoBuildFlags = [ "--bin" "jumpy" ];
60
61 env = {
62 ZSTD_SYS_USE_PKG_CONFIG = true;
63 };
64
65 # jumpy only loads assets from the current directory
66 # https://github.com/fishfolk/bones/blob/f84d07c2f2847d9acd5c07098fe1575abc496400/framework_crates/bones_asset/src/io.rs#L50
67 postInstall = ''
68 mkdir $out/share
69 cp -r assets $out/share
70 wrapProgram $out/bin/jumpy --chdir $out/share
71 '';
72
73 postFixup = lib.optionalString stdenv.isLinux ''
74 patchelf $out/bin/.jumpy-wrapped \
75 --add-rpath ${lib.makeLibraryPath [ vulkan-loader ]}
76 '';
77
78 meta = with lib; {
79 description = "A tactical 2D shooter played by up to 4 players online or on a shared screen";
80 homepage = "https://fishfight.org/";
81 changelog = "https://github.com/fishfolk/jumpy/releases/tag/v${version}";
82 license = with licenses; [ mit /* or */ asl20 ];
83 maintainers = with maintainers; [ figsoda ];
84 };
85}