1 { lib, stdenv, fetchFromGitHub, SDL2, IOKit, Foundation, cmake, makeWrapper }:
3 stdenv.mkDerivation rec {
7 src = fetchFromGitHub {
11 sha256 = "sha256-pgms2mipW1zol35LVCuU5+7mN7CBiVGFvu1CJ3CrGU0=";
12 fetchSubmodules = true;
15 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
16 # Expects SDL2.framework in specific location, which we don't have
17 # Passing this in cmakeFlags doesn't work because the path is hard-coded for Darwin
18 substituteInPlace cmake/FindSDL2.cmake \
19 --replace 'set(SDL2_LIBRARIES' 'set(SDL2_LIBRARIES "${SDL2}/lib/libSDL2.dylib") #'
24 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
34 cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
35 "-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}"
36 # Expects SDL2.framework in specific location, which we don't have
37 "-DSDL2_INCLUDE_DIRS=${SDL2.dev}/include/SDL2"
43 '' + (if stdenv.hostPlatform.isDarwin then ''
44 mkdir -p $out/{bin,Applications}
45 mv {,$out/Applications/}Bugdom.app
46 ln -s $out/{Applications/Bugdom.app/Contents/MacOS,bin}/Bugdom
48 mkdir -p $out/share/bugdom
49 mv Data $out/share/bugdom
50 install -Dm755 {.,$out/bin}/Bugdom
51 wrapProgram $out/bin/Bugdom --run "cd $out/share/bugdom"
58 description = "A port of Bugdom, a 1999 Macintosh game by Pangea Software, for modern operating systems";
59 homepage = "https://github.com/jorio/Bugdom";
60 license = with licenses; [ cc-by-sa-40 ];
61 maintainers = with maintainers; [ lux ];
62 mainProgram = "Bugdom";
63 platforms = platforms.unix;