Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 config, 3 stdenv, 4 callPackage, 5 lib, 6 fetchurl, 7 unzip, 8 licenseAccepted ? config.sc2-headless.accept_license or false, 9}: 10 11let 12 maps = callPackage ./maps.nix { inherit licenseAccepted; }; 13in 14stdenv.mkDerivation rec { 15 version = "4.7.1"; 16 pname = "sc2-headless"; 17 18 src = fetchurl { 19 url = "https://blzdistsc2-a.akamaihd.net/Linux/SC2.${version}.zip"; 20 sha256 = "0q1ry9bd3dm8y4hvh57yfq7s05hl2k2sxi2wsl6h0r3w690v1kdd"; 21 }; 22 23 unpackCmd = 24 if !licenseAccepted then 25 throw '' 26 You must accept the Blizzard® Starcraft® II AI and Machine Learning License at 27 https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html 28 by setting nixpkgs config option 'sc2-headless.accept_license = true;' 29 '' 30 else 31 assert licenseAccepted; 32 '' 33 unzip -P 'iagreetotheeula' $curSrc 34 ''; 35 36 nativeBuildInputs = [ unzip ]; 37 38 installPhase = '' 39 mkdir -p $out 40 cp -r . "$out" 41 rm -r $out/Libs 42 43 cp -ur "${maps.minigames}"/* "${maps.melee}"/* "${maps.ladder2017season1}"/* "${maps.ladder2017season2}"/* "${maps.ladder2017season3}"/* \ 44 "${maps.ladder2017season4}"/* "${maps.ladder2018season1}"/* "${maps.ladder2018season2}"/* \ 45 "${maps.ladder2018season3}"/* "${maps.ladder2018season4}"/* "${maps.ladder2019season1}"/* "$out"/Maps/ 46 ''; 47 48 preFixup = '' 49 find $out -type f -print0 | while IFS=''' read -d ''' -r file; do 50 isELF "$file" || continue 51 patchelf \ 52 --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 53 --set-rpath ${ 54 lib.makeLibraryPath [ 55 stdenv.cc.cc 56 stdenv.cc.libc 57 ] 58 } \ 59 "$file" 60 done 61 ''; 62 63 meta = { 64 platforms = lib.platforms.linux; 65 description = "Starcraft II headless linux client for machine learning research"; 66 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 67 license = { 68 fullName = "BLIZZARD® STARCRAFT® II AI AND MACHINE LEARNING LICENSE"; 69 url = "https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html"; 70 free = false; 71 }; 72 maintainers = [ ]; 73 }; 74}