1 { lib, stdenv, fetchFromGitHub, fetchzip
2 , cmake, SDL2, SDL2_mixer, Cocoa
3 , unrar-wrapper, makeWrapper
8 url = "https://archive.org/download/SpaceCadet_Plus95/Space_Cadet.rar";
9 sha256 = "sha256-fC+zsR8BY6vXpUkVd6i1jF0IZZxVKVvNi6VWCKT+pA4=";
11 }).overrideAttrs (old: {
12 nativeBuildInputs = old.nativeBuildInputs ++ [ unrar-wrapper ];
15 stdenv.mkDerivation rec {
16 pname = "SpaceCadetPinball";
19 src = fetchFromGitHub {
22 rev = "Release_${version}";
23 hash = "sha256-W2P7Txv3RtmKhQ5c0+b4ghf+OMsN+ydUZt+6tB+LClM=";
26 nativeBuildInputs = [ cmake makeWrapper ];
30 ] ++ lib.optional stdenv.hostPlatform.isDarwin Cocoa;
32 # Darwin needs a custom installphase since it is excluded from the cmake install
33 # https://github.com/k4zmu2a/SpaceCadetPinball/blob/0f88e43ba261bc21fa5c3ef9d44969a2a079d0de/CMakeLists.txt#L221
34 installPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
37 install ../bin/SpaceCadetPinball $out/bin
42 mkdir -p $out/lib/SpaceCadetPinball
43 install ${assets}/*.{DAT,DOC,MID,BMP,INF} ${assets}/Sounds/*.WAV $out/lib/SpaceCadetPinball
45 # Assets are loaded from the directory of the program is stored in
46 # https://github.com/k4zmu2a/SpaceCadetPinball/blob/de13d4e326b2dfa8e6dfb59815c0a8b9657f942d/SpaceCadetPinball/winmain.cpp#L119
47 mv $out/bin/SpaceCadetPinball $out/lib/SpaceCadetPinball
48 makeWrapper $out/lib/SpaceCadetPinball/SpaceCadetPinball $out/bin/SpaceCadetPinball
52 description = "Reverse engineering of 3D Pinball for Windows – Space Cadet, a game bundled with Windows";
53 homepage = "https://github.com/k4zmu2a/SpaceCadetPinball";
54 # The assets are unfree while the code is labeled as MIT
55 license = with licenses; [ unfree mit ];
56 maintainers = [ maintainers.hqurve ];
57 platforms = platforms.all;
58 mainProgram = "SpaceCadetPinball";