23 useSDL2 ? stdenv.hostPlatform.isDarwin, # TODO: CoreAudio fails to initialize with SDL 1.x for some reason.
26 stdenv.mkDerivation rec {
31 url = "mirror://sourceforge/quakespasm/quakespasm-${version}.tar.gz";
32 sha256 = "sha256-tXjWzkpPf04mokRY8YxLzI04VK5iUuuZgu6B2V5QGA4=";
35 sourceRoot = "${pname}-${version}/Quake";
37 patches = lib.optionals stdenv.hostPlatform.isDarwin [
38 # Makes Darwin Makefile use system libraries instead of ones from app bundle
39 ./quakespasm-darwin-makefile-improvements.patch
42 # Quakespasm tries to set a 10.6 deployment target, but that’s too low for SDL2.
44 sed -i Makefile.darwin -e '/-mmacosx-version-min/d'
62 (if useSDL2 then SDL2 else SDL)
64 ++ lib.optionals stdenv.hostPlatform.isDarwin [
70 ++ lib.optionals (stdenv.hostPlatform.isDarwin && useSDL2) [
77 # Makefile defaults, set here to enforce consistency on Darwin build
89 ++ lib.optionals useSDL2 [
90 "SDL_CONFIG=sdl2-config"
94 makefile = if (stdenv.hostPlatform.isDarwin) then "Makefile.darwin" else "Makefile";
98 substituteInPlace Makefile --replace "/usr/local/games" "$out/bin"
99 substituteInPlace Makefile.darwin --replace "/usr/local/games" "$out/bin"
102 postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
103 # Let's build app bundle
104 mkdir -p $out/Applications/Quake.app/Contents/MacOS
105 mkdir -p $out/Applications/Quake.app/Contents/Resources
106 cp ../MacOSX/Info.plist $out/Applications/Quake.app/Contents/
107 cp ../MacOSX/QuakeSpasm.icns $out/Applications/Quake.app/Contents/Resources/
108 cp -r ../MacOSX/English.lproj $out/Applications/Quake.app/Contents/Resources/
109 ln -sf $out/bin/quake $out/Applications/Quake.app/Contents/MacOS/quake
111 substituteInPlace $out/Applications/Quake.app/Contents/Info.plist \
112 --replace '>''${EXECUTABLE_NAME}' '>quake'
113 substituteInPlace $out/Applications/Quake.app/Contents/Info.plist \
114 --replace '>''${PRODUCT_NAME}' '>QuakeSpasm'
117 enableParallelBuilding = true;
123 desktopName = "Quakespasm";
124 categories = [ "Game" ];
129 description = "Engine for iD software's Quake";
130 homepage = "https://quakespasm.sourceforge.net/";
132 QuakeSpasm is a modern, cross-platform Quake 1 engine based on FitzQuake.
133 It includes support for 64 bit CPUs and custom music playback, a new sound driver,
134 some graphical niceities, and numerous bug-fixes and other improvements.
135 Quakespasm utilizes either the SDL or SDL2 frameworks, so choose which one
136 works best for you. SDL is probably less buggy, but SDL2 has nicer features
137 and smoother mouse input - though no CD support.
140 platforms = platforms.unix;
141 maintainers = with maintainers; [ mikroskeem ];
142 mainProgram = "quake";