1 { lib, stdenv, fetchFromGitHub, fetchzip
2 , cmake, SDL2, SDL2_mixer, Cocoa
3 , unrar-wrapper, makeWrapper
9 url = "https://archive.org/download/SpaceCadet_Plus95/Space_Cadet.rar";
10 sha256 = "sha256-fC+zsR8BY6vXpUkVd6i1jF0IZZxVKVvNi6VWCKT+pA4=";
12 }).overrideAttrs (old: {
13 nativeBuildInputs = old.nativeBuildInputs ++ [ unrar-wrapper ];
16 stdenv.mkDerivation rec {
17 pname = "SpaceCadetPinball";
20 src = fetchFromGitHub {
23 rev = "Release_${version}";
24 sha256 = "sha256-LmYplJr1Mg4yNg9eP02FXf9mL1FnzNBhpted3GpmlQ0=";
28 # remove when updating past 2.0.1
30 name = "fix-install-directories";
31 url = "https://github.com/k4zmu2a/SpaceCadetPinball/commit/d8ee1b9bfeee21d3981a40e735411393392bc1f6.patch";
32 sha256 = "sha256-BtCDJ+a9AFaOM8nyId0eU9GN/gUQT2kFCO4RIVTzZlE=";
36 nativeBuildInputs = [ cmake makeWrapper ];
40 ] ++ lib.optional stdenv.isDarwin Cocoa;
42 # Darwin needs a custom installphase since it is excluded from the cmake install
43 # https://github.com/k4zmu2a/SpaceCadetPinball/blob/0f88e43ba261bc21fa5c3ef9d44969a2a079d0de/CMakeLists.txt#L221
44 installPhase = lib.optionalString stdenv.isDarwin ''
47 install ../bin/SpaceCadetPinball $out/bin
52 mkdir -p $out/lib/SpaceCadetPinball
53 install ${assets}/*.{DAT,DOC,MID,BMP,INF} ${assets}/Sounds/*.WAV $out/lib/SpaceCadetPinball
55 # Assets are loaded from the directory of the program is stored in
56 # https://github.com/k4zmu2a/SpaceCadetPinball/blob/de13d4e326b2dfa8e6dfb59815c0a8b9657f942d/SpaceCadetPinball/winmain.cpp#L119
57 mv $out/bin/SpaceCadetPinball $out/lib/SpaceCadetPinball
58 makeWrapper $out/lib/SpaceCadetPinball/SpaceCadetPinball $out/bin/SpaceCadetPinball
62 description = "Reverse engineering of 3D Pinball for Windows – Space Cadet, a game bundled with Windows";
63 homepage = "https://github.com/k4zmu2a/SpaceCadetPinball";
64 # The assets are unfree while the code is labeled as MIT
65 license = with licenses; [ unfree mit ];
66 maintainers = [ maintainers.hqurve ];
67 platforms = platforms.all;
68 mainProgram = "SpaceCadetPinball";