2022-05-08 22:40:50 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2024-03-16 09:36:10 +00:00
|
|
|
, fetchzip
|
2022-05-08 22:40:50 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, curl
|
|
|
|
, nasm
|
2022-07-20 14:18:25 +00:00
|
|
|
, game-music-emu
|
2022-05-08 22:40:50 +00:00
|
|
|
, libpng
|
|
|
|
, SDL2
|
|
|
|
, SDL2_mixer
|
|
|
|
, zlib
|
2024-03-16 09:36:10 +00:00
|
|
|
, makeWrapper
|
2024-03-16 10:09:48 +00:00
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
2022-05-08 22:40:50 +00:00
|
|
|
}:
|
|
|
|
|
2024-03-16 09:36:10 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-05-08 22:40:50 +00:00
|
|
|
pname = "srb2kart";
|
2024-03-16 09:36:10 +00:00
|
|
|
version = "1.6";
|
2022-05-08 22:40:50 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "STJr";
|
|
|
|
repo = "Kart-Public";
|
2024-03-16 09:36:10 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
2024-03-15 05:45:41 +00:00
|
|
|
hash = "sha256-5sIHdeenWZjczyYM2q+F8Y1SyLqL+y77yxYDUM3dVA0=";
|
2022-05-08 22:40:50 +00:00
|
|
|
};
|
|
|
|
|
2024-03-16 09:36:10 +00:00
|
|
|
assets = stdenv.mkDerivation {
|
|
|
|
pname = "srb2kart-data";
|
|
|
|
version = finalAttrs.version;
|
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/STJr/Kart-Public/releases/download/v${finalAttrs.version}/AssetsLinuxOnly.zip";
|
|
|
|
hash = "sha256-yaVdsQUnyobjSbmemeBEyu35GeZCX1ylTRcjcbDuIu4=";
|
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/share/srb2kart
|
|
|
|
cp -r * $out/share/srb2kart
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-05-08 22:40:50 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
nasm
|
2024-03-16 09:36:10 +00:00
|
|
|
makeWrapper
|
2024-03-16 10:09:48 +00:00
|
|
|
copyDesktopItems
|
2022-05-08 22:40:50 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
curl
|
2022-07-20 14:18:25 +00:00
|
|
|
game-music-emu
|
2022-05-08 22:40:50 +00:00
|
|
|
libpng
|
|
|
|
SDL2
|
|
|
|
SDL2_mixer
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
2024-03-16 09:36:10 +00:00
|
|
|
"-DSRB2_ASSET_DIRECTORY=${finalAttrs.assets}/share/srb2kart"
|
2022-07-20 14:18:25 +00:00
|
|
|
"-DGME_INCLUDE_DIR=${game-music-emu}/include"
|
2022-09-18 10:48:40 +00:00
|
|
|
"-DSDL2_MIXER_INCLUDE_DIR=${lib.getDev SDL2_mixer}/include/SDL2"
|
|
|
|
"-DSDL2_INCLUDE_DIR=${lib.getDev SDL2}/include/SDL2"
|
2022-05-08 22:40:50 +00:00
|
|
|
];
|
|
|
|
|
2024-03-16 10:09:48 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem rec {
|
|
|
|
name = "Sonic Robo Blast 2 Kart";
|
|
|
|
exec = finalAttrs.pname;
|
|
|
|
icon = finalAttrs.pname;
|
|
|
|
comment = "Kart racing mod based on SRB2";
|
|
|
|
desktopName = name;
|
|
|
|
genericName = name;
|
|
|
|
startupWMClass = ".srb2kart-wrapped";
|
|
|
|
categories = [ "Game" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-03-16 09:36:10 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2022-05-08 22:40:50 +00:00
|
|
|
|
2024-03-16 09:36:10 +00:00
|
|
|
install -Dm644 ../srb2.png $out/share/pixmaps/srb2kart.png
|
|
|
|
install -Dm644 ../srb2.png $out/share/icons/srb2kart.png
|
|
|
|
install -Dm755 bin/srb2kart $out/bin/srb2kart
|
2022-05-08 22:40:50 +00:00
|
|
|
|
2024-03-16 09:36:10 +00:00
|
|
|
wrapProgram $out/bin/srb2kart \
|
|
|
|
--set SRB2WADDIR "${finalAttrs.assets}/share/srb2kart"
|
2022-05-08 22:40:50 +00:00
|
|
|
|
2024-03-16 09:36:10 +00:00
|
|
|
runHook postInstall
|
2022-05-08 22:40:50 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "SRB2Kart is a classic styled kart racer";
|
|
|
|
homepage = "https://mb.srb2.org/threads/srb2kart.25868/";
|
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl2Plus;
|
2024-03-15 05:33:53 +00:00
|
|
|
maintainers = with maintainers; [ viric donovanglover ];
|
2024-03-15 05:58:14 +00:00
|
|
|
mainProgram = "srb2kart";
|
2022-05-08 22:40:50 +00:00
|
|
|
};
|
2024-03-16 09:36:10 +00:00
|
|
|
})
|