nixpkgs/pkgs/games/jumpy/default.nix
2023-05-08 10:52:00 -04:00

89 lines
1.9 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, makeWrapper
, pkg-config
, zstd
, stdenv
, alsa-lib
, libxkbcommon
, udev
, vulkan-loader
, wayland
, xorg
, darwin
}:
rustPlatform.buildRustPackage rec {
pname = "jumpy";
version = "0.7.0";
src = fetchFromGitHub {
owner = "fishfolk";
repo = pname;
rev = "v${version}";
sha256 = "sha256-krO/iPGnzXeY3W8xSFerlKa1DvDl7ss00bGaAMkHUtw=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"bevy_simple_tilemap-0.10.1" = "sha256-Q/AsBZjsr+uTIh/oN0OsIJxntZ4nuc1AReo0Ronj930=";
"bones_asset-0.1.0" = "sha256-YyY5OsbRLkpAgvNifRiXfmzfsgFw/oFV1nQVCkXG4j4=";
};
};
patches = [
# jumpy uses an outdated version of mimalloc
# which fails to build on aarch64-linux
./update-mimalloc.patch
];
nativeBuildInputs = [
makeWrapper
pkg-config
];
buildInputs = [
zstd
] ++ lib.optionals stdenv.isLinux [
alsa-lib
libxkbcommon
udev
vulkan-loader
wayland
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Cocoa
rustPlatform.bindgenHook
];
cargoBuildFlags = [ "--bin" "jumpy" ];
env = {
ZSTD_SYS_USE_PKG_CONFIG = true;
};
postInstall = ''
mkdir $out/share
cp -r assets $out/share
wrapProgram $out/bin/jumpy \
--set-default JUMPY_ASSET_DIR $out/share/assets
'';
postFixup = lib.optionalString stdenv.isLinux ''
patchelf $out/bin/.jumpy-wrapped \
--add-rpath ${lib.makeLibraryPath [ vulkan-loader ]}
'';
meta = with lib; {
description = "A tactical 2D shooter played by up to 4 players online or on a shared screen";
homepage = "https://fishfight.org/";
changelog = "https://github.com/fishfolk/jumpy/releases/tag/v${version}";
license = with licenses; [ mit /* or */ asl20 ];
maintainers = with maintainers; [ figsoda ];
};
}