1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 fetchpatch2,
6 makeWrapper,
7 pkg-config,
8 zstd,
9 stdenv,
10 alsa-lib,
11 libxkbcommon,
12 udev,
13 vulkan-loader,
14 wayland,
15 xorg,
16}:
17
18rustPlatform.buildRustPackage (finalAttrs: {
19 pname = "jumpy";
20 version = "0.12.2";
21
22 src = fetchFromGitHub {
23 owner = "fishfolk";
24 repo = "jumpy";
25 tag = "v${finalAttrs.version}";
26 hash = "sha256-g/CpSycTCM1i6O7Mir+3huabvr4EXghDApquEUNny8c=";
27 };
28
29 # This patch may be removed in the next release
30 cargoPatches = [
31 (fetchpatch2 {
32 url = "https://github.com/fishfolk/jumpy/commit/8234e6d2c0b33c75e2112596ded1734fdba50fb8.patch?full_index=1";
33 hash = "sha256-IWjBw1Wj/6CT/x6xm6vfpUMfk7A5/EsdbPDvWywRFc8=";
34 })
35 ];
36
37 cargoHash = "sha256-2I9s1zH94GRqXGBxZYyXOQwNeYrpV1UhUSKGCs9Ce9Q=";
38
39 nativeBuildInputs = [
40 makeWrapper
41 pkg-config
42 ];
43
44 buildInputs = [
45 zstd
46 ]
47 ++ lib.optionals stdenv.hostPlatform.isLinux [
48 alsa-lib
49 libxkbcommon
50 udev
51 vulkan-loader
52 wayland
53 xorg.libX11
54 xorg.libXcursor
55 xorg.libXi
56 xorg.libXrandr
57 ]
58 ++ lib.optionals stdenv.hostPlatform.isDarwin [
59 rustPlatform.bindgenHook
60 ];
61
62 cargoBuildFlags = [
63 "--bin"
64 "jumpy"
65 ];
66
67 env = {
68 ZSTD_SYS_USE_PKG_CONFIG = true;
69 };
70
71 # jumpy only loads assets from the current directory
72 # https://github.com/fishfolk/bones/blob/f84d07c2f2847d9acd5c07098fe1575abc496400/framework_crates/bones_asset/src/io.rs#L50
73 postInstall = ''
74 mkdir $out/share
75 cp -r assets $out/share
76 wrapProgram $out/bin/jumpy --chdir $out/share
77 '';
78
79 postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
80 patchelf $out/bin/.jumpy-wrapped \
81 --add-rpath ${lib.makeLibraryPath [ vulkan-loader ]}
82 '';
83
84 meta = {
85 description = "Tactical 2D shooter played by up to 4 players online or on a shared screen";
86 mainProgram = "jumpy";
87 homepage = "https://fishfolk.org/games/jumpy";
88 changelog = "https://github.com/fishfolk/jumpy/releases/tag/v${finalAttrs.version}";
89 license = with lib.licenses; [
90 mit # or
91 asl20
92 # Assets
93 cc-by-nc-40
94 ];
95 maintainers = with lib.maintainers; [ figsoda ];
96 };
97})