2019-02-03 15:33:29 +00:00
|
|
|
{ config, stdenv
|
2017-11-14 19:34:06 +00:00
|
|
|
, callPackage
|
2017-10-16 20:56:07 +01:00
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, unzip
|
2019-02-03 15:33:29 +00:00
|
|
|
, licenseAccepted ? config.sc2-headless.accept_license or false
|
2017-10-16 20:56:07 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
if !licenseAccepted then throw ''
|
|
|
|
You must accept the Blizzard® Starcraft® II AI and Machine Learning License at
|
|
|
|
https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html
|
|
|
|
by setting nixpkgs config option 'sc2-headless.accept_license = true;'
|
|
|
|
''
|
|
|
|
else assert licenseAccepted;
|
2017-11-14 19:34:06 +00:00
|
|
|
let maps = callPackage ./maps.nix {};
|
|
|
|
in stdenv.mkDerivation rec {
|
2019-01-31 14:21:58 +00:00
|
|
|
version = "4.7.1";
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "sc2-headless";
|
2017-10-16 20:56:07 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://blzdistsc2-a.akamaihd.net/Linux/SC2.${version}.zip";
|
2019-01-31 14:21:58 +00:00
|
|
|
sha256 = "0q1ry9bd3dm8y4hvh57yfq7s05hl2k2sxi2wsl6h0r3w690v1kdd";
|
2017-10-16 20:56:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
unpackCmd = ''
|
|
|
|
unzip -P 'iagreetotheeula' $curSrc
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -r . "$out"
|
|
|
|
rm -r $out/Libs
|
2017-11-14 19:34:06 +00:00
|
|
|
|
2019-02-22 04:32:24 +00:00
|
|
|
cp -ur "${maps.minigames}"/* "${maps.melee}"/* "${maps.ladder2017season1}"/* "${maps.ladder2017season2}"/* "${maps.ladder2017season3}"/* \
|
|
|
|
"${maps.ladder2017season4}"/* "${maps.ladder2018season1}"/* "${maps.ladder2018season2}"/* \
|
|
|
|
"${maps.ladder2018season3}"/* "${maps.ladder2018season4}"/* "${maps.ladder2019season1}"/* "$out"/Maps/
|
2017-10-16 20:56:07 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preFixup = ''
|
|
|
|
find $out -type f -print0 | while IFS=''' read -d ''' -r file; do
|
|
|
|
isELF "$file" || continue
|
|
|
|
patchelf \
|
|
|
|
--interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath ${lib.makeLibraryPath [stdenv.cc.cc stdenv.cc.libc]} \
|
|
|
|
"$file"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
description = "Starcraft II headless linux client for machine learning research";
|
|
|
|
license = {
|
|
|
|
fullName = "BLIZZARD® STARCRAFT® II AI AND MACHINE LEARNING LICENSE";
|
|
|
|
url = "https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html";
|
2017-10-16 22:06:48 +01:00
|
|
|
free = false;
|
2017-10-16 20:56:07 +01:00
|
|
|
};
|
2017-11-14 19:34:06 +00:00
|
|
|
maintainers = with lib.maintainers; [ danharaj ];
|
2017-10-16 20:56:07 +01:00
|
|
|
};
|
|
|
|
}
|