{ stdenv, fetchFromGitHub, jam, pkgconfig, gtk2, SDL, SDL_mixer, SDL_sound, smpeg, libvorbis }: let jamenv = if stdenv.isDarwin then '' export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${SDL.dev}/include/SDL" export GARGLKINI="$out/Applications/Gargoyle.app/Contents/Resources/garglk.ini" '' else '' export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/libexec/gargoyle" export DESTDIR="$out" export _BINDIR=libexec/gargoyle export _APPDIR=libexec/gargoyle export _LIBDIR=libexec/gargoyle export GARGLKINI="$out/etc/garglk.ini" ''; in stdenv.mkDerivation { name = "gargoyle-2017-03-12"; src = fetchFromGitHub { owner = "garglk"; repo = "garglk"; rev = "7d8fe875927c332ea30d75656bc982354b42f602"; sha256 = "00nac7j84gfql1cr11cs9ad4j1gsxrnkqfx6mis4ijf7d6px3sih"; }; nativeBuildInputs = [ jam pkgconfig ]; buildInputs = [ gtk2 SDL SDL_mixer ] ++ ( if stdenv.isDarwin then [ smpeg libvorbis ] else [ SDL_sound ] ); patches = [ ./darwin.patch ]; buildPhase = jamenv + "jam -j$NIX_BUILD_CORES"; installPhase = if stdenv.isDarwin then (builtins.readFile ./darwin.sh) else jamenv + '' jam -j$NIX_BUILD_CORES install mkdir -p "$out/bin" ln -s ../libexec/gargoyle/gargoyle "$out/bin" mkdir -p "$out/etc" cp garglk/garglk.ini "$out/etc" mkdir -p "$out/share/applications" cp garglk/gargoyle.desktop "$out/share/applications" mkdir -p "$out/share/icons/hicolor/32x32/apps" cp garglk/gargoyle-house.png "$out/share/icons/hicolor/32x32/apps" ''; enableParallelBuilding = true; meta = with stdenv.lib; { homepage = http://ccxvii.net/gargoyle/; license = licenses.gpl2Plus; description = "Interactive fiction interpreter GUI"; platforms = platforms.unix; maintainers = with maintainers; [ orivej ]; }; }