Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 129 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 makeWrapper, 6 makeDesktopItem, 7 copyDesktopItems, 8 SDL2, 9 bzip2, 10 cmake, 11 game-music-emu, 12 gtk3, 13 imagemagick, 14 libGL, 15 libjpeg, 16 libvpx, 17 libwebp, 18 ninja, 19 openal, 20 pkg-config, 21 vulkan-loader, 22 zlib, 23 zmusic, 24}: 25 26stdenv.mkDerivation rec { 27 pname = "gzdoom"; 28 version = "4.14.2"; 29 30 src = fetchFromGitHub { 31 owner = "ZDoom"; 32 repo = "gzdoom"; 33 rev = "g${version}"; 34 fetchSubmodules = true; 35 hash = "sha256-kYw+r08v/Q/hphJuvjn38Dj5mZRijE6pWKoEZBlN5P4="; 36 }; 37 38 outputs = [ "out" ] ++ lib.optionals stdenv.hostPlatform.isLinux [ "doc" ]; 39 40 nativeBuildInputs = [ 41 cmake 42 imagemagick 43 makeWrapper 44 ninja 45 pkg-config 46 ] 47 ++ lib.optionals stdenv.hostPlatform.isLinux [ copyDesktopItems ]; 48 49 buildInputs = [ 50 SDL2 51 zlib 52 bzip2 53 gtk3 54 55 # Graphics 56 libGL 57 libjpeg 58 libvpx 59 libwebp 60 vulkan-loader 61 62 # Sound (ZMusic contain MIDI libs) 63 game-music-emu 64 openal 65 zmusic 66 ]; 67 68 postPatch = '' 69 substituteInPlace tools/updaterevision/UpdateRevision.cmake \ 70 --replace-fail "ret_var(Tag)" "ret_var(\"${src.rev}\")" \ 71 --replace-fail "ret_var(Timestamp)" "ret_var(\"1970-00-00 00:00:00 +0000\")" \ 72 --replace-fail "ret_var(Hash)" "ret_var(\"${src.rev}\")" \ 73 --replace-fail "<unknown version>" "${src.rev}" 74 ''; 75 76 # Apple dropped GL support 77 # Shader's loading will throw an error while linking 78 cmakeFlags = [ 79 "-DDYN_GTK=OFF" 80 "-DDYN_OPENAL=OFF" 81 ] 82 ++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DHAVE_GLES2=OFF" ]; 83 84 desktopItems = lib.optionals stdenv.hostPlatform.isLinux [ 85 (makeDesktopItem { 86 name = "gzdoom"; 87 exec = "gzdoom"; 88 desktopName = "GZDoom"; 89 comment = meta.description; 90 icon = "gzdoom"; 91 categories = [ "Game" ]; 92 }) 93 ]; 94 95 installPhase = lib.optionalString stdenv.hostPlatform.isDarwin '' 96 mkdir -p "$out/Applications" 97 mv gzdoom.app "$out/Applications/" 98 ''; 99 100 postInstall = lib.optionalString stdenv.hostPlatform.isLinux '' 101 mv $out/bin/gzdoom $out/share/games/doom/gzdoom 102 makeWrapper $out/share/games/doom/gzdoom $out/bin/gzdoom \ 103 --set LD_LIBRARY_PATH ${lib.makeLibraryPath [ vulkan-loader ]} 104 105 for size in 16 24 32 48 64 128; do 106 mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps 107 magick $src/src/win32/icon1.ico -background none -resize "$size"x"$size" -flatten \ 108 $out/share/icons/hicolor/"$size"x"$size"/apps/gzdoom.png 109 done; 110 ''; 111 112 meta = { 113 homepage = "https://github.com/ZDoom/gzdoom"; 114 description = "Modder-friendly OpenGL and Vulkan source port based on the DOOM engine"; 115 mainProgram = "gzdoom"; 116 longDescription = '' 117 GZDoom is a feature centric port for all DOOM engine games, based on 118 ZDoom, adding an OpenGL renderer and powerful scripting capabilities. 119 ''; 120 license = lib.licenses.gpl3Plus; 121 platforms = with lib.platforms; linux ++ darwin; 122 maintainers = with lib.maintainers; [ 123 azahi 124 lassulus 125 Gliczy 126 r4v3n6101 127 ]; 128 }; 129}