2021-12-19 01:06:50 +00:00
|
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchzip
|
2022-04-03 18:54:34 +00:00
|
|
|
|
, cmake, SDL2, SDL2_mixer, Cocoa
|
2021-12-19 01:06:50 +00:00
|
|
|
|
, unrar-wrapper, makeWrapper
|
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
assets = (fetchzip {
|
|
|
|
|
url = "https://archive.org/download/SpaceCadet_Plus95/Space_Cadet.rar";
|
|
|
|
|
sha256 = "sha256-fC+zsR8BY6vXpUkVd6i1jF0IZZxVKVvNi6VWCKT+pA4=";
|
|
|
|
|
stripRoot = false;
|
|
|
|
|
}).overrideAttrs (old: {
|
|
|
|
|
nativeBuildInputs = old.nativeBuildInputs ++ [ unrar-wrapper ];
|
|
|
|
|
});
|
|
|
|
|
in
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "SpaceCadetPinball";
|
2024-04-21 15:54:59 +00:00
|
|
|
|
version = "2.1.0";
|
2021-12-19 01:06:50 +00:00
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "k4zmu2a";
|
|
|
|
|
repo = pname;
|
2022-01-03 16:56:52 +00:00
|
|
|
|
rev = "Release_${version}";
|
2024-04-21 15:54:59 +00:00
|
|
|
|
hash = "sha256-W2P7Txv3RtmKhQ5c0+b4ghf+OMsN+ydUZt+6tB+LClM=";
|
2021-12-19 01:06:50 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
|
nativeBuildInputs = [ cmake makeWrapper ];
|
2021-12-19 01:06:50 +00:00
|
|
|
|
buildInputs = [
|
|
|
|
|
SDL2
|
|
|
|
|
SDL2_mixer
|
2024-09-26 11:04:55 +00:00
|
|
|
|
] ++ lib.optional stdenv.hostPlatform.isDarwin Cocoa;
|
2022-04-03 18:54:34 +00:00
|
|
|
|
|
|
|
|
|
# Darwin needs a custom installphase since it is excluded from the cmake install
|
|
|
|
|
# https://github.com/k4zmu2a/SpaceCadetPinball/blob/0f88e43ba261bc21fa5c3ef9d44969a2a079d0de/CMakeLists.txt#L221
|
2024-09-26 11:04:55 +00:00
|
|
|
|
installPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2022-04-03 18:54:34 +00:00
|
|
|
|
runHook preInstall
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
|
install ../bin/SpaceCadetPinball $out/bin
|
|
|
|
|
runHook postInstall
|
|
|
|
|
'';
|
2021-12-19 01:06:50 +00:00
|
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
|
mkdir -p $out/lib/SpaceCadetPinball
|
|
|
|
|
install ${assets}/*.{DAT,DOC,MID,BMP,INF} ${assets}/Sounds/*.WAV $out/lib/SpaceCadetPinball
|
|
|
|
|
|
|
|
|
|
# Assets are loaded from the directory of the program is stored in
|
|
|
|
|
# https://github.com/k4zmu2a/SpaceCadetPinball/blob/de13d4e326b2dfa8e6dfb59815c0a8b9657f942d/SpaceCadetPinball/winmain.cpp#L119
|
|
|
|
|
mv $out/bin/SpaceCadetPinball $out/lib/SpaceCadetPinball
|
|
|
|
|
makeWrapper $out/lib/SpaceCadetPinball/SpaceCadetPinball $out/bin/SpaceCadetPinball
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
|
description = "Reverse engineering of 3D Pinball for Windows – Space Cadet, a game bundled with Windows";
|
|
|
|
|
homepage = "https://github.com/k4zmu2a/SpaceCadetPinball";
|
|
|
|
|
# The assets are unfree while the code is labeled as MIT
|
|
|
|
|
license = with licenses; [ unfree mit ];
|
|
|
|
|
maintainers = [ maintainers.hqurve ];
|
|
|
|
|
platforms = platforms.all;
|
2022-04-03 18:54:34 +00:00
|
|
|
|
mainProgram = "SpaceCadetPinball";
|
2021-12-19 01:06:50 +00:00
|
|
|
|
};
|
|
|
|
|
}
|