1 { lib, stdenv, fetchFromGitHub, SDL2, IOKit, Foundation, OpenGL, cmake, makeWrapper }:
3 stdenv.mkDerivation rec {
7 src = fetchFromGitHub {
11 hash = "sha256-0c7v5tSqYuqtLOFl4sqD7+naJNqX/wlKHVntkZQGJ8A=";
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") #'
20 # Expects plutil, which we don't have
21 sed -i '/plutil/d' CMakeLists.txt
26 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
37 cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
38 "-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}"
39 # Expects SDL2.framework in specific location, which we don't have
40 "-DSDL2_INCLUDE_DIRS=${SDL2.dev}/include/SDL2"
46 '' + (if stdenv.hostPlatform.isDarwin then ''
47 mkdir -p $out/{bin,Applications}
48 mv {,$out/Applications/}Bugdom.app
49 makeWrapper $out/{Applications/Bugdom.app/Contents/MacOS,bin}/Bugdom
51 mkdir -p $out/share/bugdom
52 mv Data $out/share/bugdom
53 install -Dm755 {.,$out/bin}/Bugdom
54 wrapProgram $out/bin/Bugdom --run "cd $out/share/bugdom"
55 install -Dm644 $src/packaging/io.jor.bugdom.desktop $out/share/applications/io.jor.bugdom.desktop
56 install -Dm644 $src/packaging/io.jor.bugdom.png $out/share/pixmaps/io.jor.bugdom.png
63 description = "Port of Bugdom, a 1999 Macintosh game by Pangea Software, for modern operating systems";
64 homepage = "https://github.com/jorio/Bugdom";
65 license = with licenses; [ cc-by-sa-40 ];
66 maintainers = with maintainers; [ lux ];
67 mainProgram = "Bugdom";
68 platforms = platforms.unix;