Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 130 lines 3.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cargo, 6 cmake, 7 ninja, 8 pkg-config, 9 rustPlatform, 10 rustc, 11 curl, 12 freetype, 13 libGLU, 14 libnotify, 15 libogg, 16 libX11, 17 opusfile, 18 pcre, 19 python3, 20 SDL2, 21 sqlite, 22 wavpack, 23 ffmpeg, 24 x264, 25 vulkan-headers, 26 vulkan-loader, 27 glslang, 28 spirv-tools, 29 glew, 30}: 31let 32 clientExecutable = "TaterClient-DDNet"; 33in 34stdenv.mkDerivation (finalAttrs: { 35 pname = "taterclient-ddnet"; 36 version = "10.4.0"; 37 38 src = fetchFromGitHub { 39 owner = "sjrc6"; 40 repo = "taterclient-ddnet"; 41 tag = "V${finalAttrs.version}"; 42 hash = "sha256-SSf9W+1yl7ExHsifbVM5IN4OfZvMdz62xMfdb++38II="; 43 }; 44 45 cargoDeps = rustPlatform.fetchCargoVendor { 46 inherit (finalAttrs) pname src version; 47 hash = "sha256-VKGc4LQjt2FHbELLBKtV8rKpxjGBrzlA3m9BSdZ/6Z0="; 48 }; 49 50 nativeBuildInputs = [ 51 cmake 52 ninja 53 pkg-config 54 rustc 55 cargo 56 rustPlatform.cargoSetupHook 57 glslang # for glslangValidator 58 python3 59 ]; 60 61 buildInputs = [ 62 curl 63 libnotify 64 pcre 65 sqlite 66 freetype 67 libGLU 68 libogg 69 opusfile 70 SDL2 71 wavpack 72 ffmpeg 73 x264 74 vulkan-loader 75 vulkan-headers 76 glslang 77 spirv-tools 78 glew 79 ] 80 ++ lib.optionals stdenv.hostPlatform.isLinux [ libX11 ]; 81 82 strictDeps = true; 83 84 postPatch = '' 85 substituteInPlace src/engine/shared/storage.cpp \ 86 --replace-fail /usr/ $out/ 87 ''; 88 89 cmakeFlags = [ 90 (lib.cmakeBool "AUTOUPDATE" false) 91 (lib.cmakeBool "CLIENT" true) 92 (lib.cmakeBool "SERVER" false) 93 (lib.cmakeBool "TOOLS" false) 94 (lib.cmakeBool "DISCORD" false) 95 (lib.cmakeFeature "CLIENT_EXECUTABLE" clientExecutable) 96 ]; 97 98 # Since we are not building the server executable, the `run_tests` Makefile target 99 # will not be generated. 100 # 101 # See https://github.com/sjrc6/TaterClient-ddnet/blob/V10.4.0/CMakeLists.txt#L3088 102 doCheck = false; 103 104 preFixup = lib.optionalString stdenv.hostPlatform.isDarwin '' 105 # Upstream links against <prefix>/lib while it installs this library in <prefix>/lib/ddnet 106 install_name_tool -change "$out/lib/libsteam_api.dylib" "$out/lib/ddnet/libsteam_api.dylib" "$out/bin/${clientExecutable}" 107 ''; 108 109 postInstall = '' 110 # Desktop application conflicts with the ddnet package 111 mv "$out/share/applications/ddnet.desktop" "$out/share/applications/taterclient-ddnet.desktop" 112 113 substituteInPlace $out/share/applications/taterclient-ddnet.desktop \ 114 --replace-fail "Exec=DDNet" "Exec=${clientExecutable}" \ 115 --replace-fail "Name=DDNet" "Name=TaterClient (DDNet)" \ 116 --replace-fail "Comment=Launch DDNet" "Comment=Launch ${clientExecutable}" 117 ''; 118 119 meta = { 120 description = "Modification of DDNet teeworlds client"; 121 homepage = "https://github.com/sjrc6/taterclient-ddnet"; 122 changelog = "https://github.com/sjrc6/taterclient-ddnet/releases"; 123 license = lib.licenses.asl20; 124 maintainers = with lib.maintainers; [ 125 melon 126 theobori 127 ]; 128 mainProgram = clientExecutable; 129 }; 130})