diff options
Diffstat (limited to 'pkgs/applications/science/machine-learning/sc2-headless/default.nix')
-rw-r--r-- | pkgs/applications/science/machine-learning/sc2-headless/default.nix | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/applications/science/machine-learning/sc2-headless/default.nix b/pkgs/applications/science/machine-learning/sc2-headless/default.nix new file mode 100644 index 000000000000..c06bfc04e07c --- /dev/null +++ b/pkgs/applications/science/machine-learning/sc2-headless/default.nix @@ -0,0 +1,54 @@ +{ stdenv +, lib +, fetchurl +, unzip +, licenseAccepted ? false +}: + +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; +stdenv.mkDerivation rec { + version = "3.17"; + name = "sc2-headless-${version}"; + + src = fetchurl { + url = "https://blzdistsc2-a.akamaihd.net/Linux/SC2.${version}.zip"; + sha256 = "1biyxpf7n95hali1pw30h91rhzrj6sbwrx6s52d00mlnwdhmf2v0"; + }; + + unpackCmd = '' + unzip -P 'iagreetotheeula' $curSrc + ''; + + nativeBuildInputs = [ unzip ]; + + installPhase = '' + mkdir -p $out + cp -r . "$out" + rm -r $out/Libs + ''; + + 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"; + free = false; + }; + }; +} |