diff options
author | Katharina Fey <kookie@spacekookie.de> | 2020-04-19 14:57:25 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2020-04-19 14:57:25 +0200 |
commit | 0ca211d4ec600fa7b3cc701e4997cd1e8d38ebdc (patch) | |
tree | 4f9b09ca5d55e44710f020bcf6621daa4fd6b73a /nixpkgs/pkgs/games/katago | |
parent | 1c2ef52230ed2c8b2529c47ce6a857bdde46c7c7 (diff) | |
parent | b61999e4ad60c351b4da63ae3ff43aae3c0bbdfb (diff) |
Merge commit 'b61999e4ad60c351b4da63ae3ff43aae3c0bbdfb'
Diffstat (limited to 'nixpkgs/pkgs/games/katago')
-rw-r--r-- | nixpkgs/pkgs/games/katago/default.nix | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/games/katago/default.nix b/nixpkgs/pkgs/games/katago/default.nix new file mode 100644 index 00000000000..cbbdb538513 --- /dev/null +++ b/nixpkgs/pkgs/games/katago/default.nix @@ -0,0 +1,97 @@ +{ stdenv +, gcc8Stdenv +, lib +, libzip +, boost +, cmake +, makeWrapper +, fetchFromGitHub +, cudnn ? null +, cudatoolkit ? null +, libGL_driver ? null +, opencl-headers ? null +, ocl-icd ? null +, gperftools ? null +, cudaSupport ? false +, useTcmalloc ? true}: + +assert cudaSupport -> ( + libGL_driver != null && + cudatoolkit != null && + cudnn != null); + +assert !cudaSupport -> ( + opencl-headers != null && + ocl-icd != null); + +assert useTcmalloc -> ( + gperftools != null); + +let + env = if cudaSupport + then gcc8Stdenv + else stdenv; + +in env.mkDerivation rec { + pname = "katago"; + version = "1.3.5"; + + src = fetchFromGitHub { + owner = "lightvector"; + repo = "katago"; + rev = "v${version}"; + sha256 = "1625s3fh0xc2ldgyl6sjdjmpliyys7rzzkcys6h9x6k828g8n0lq"; + }; + + nativeBuildInputs = [ + cmake + makeWrapper + ]; + + buildInputs = [ + libzip + boost + ] ++ lib.optionals cudaSupport [ + cudnn + libGL_driver + ] ++ lib.optionals (!cudaSupport) [ + opencl-headers + ocl-icd + ] ++ lib.optionals useTcmalloc [ + gperftools + ]; + + cmakeFlags = [ + "-DNO_GIT_REVISION=ON" + ] ++ lib.optionals cudaSupport [ + "-DUSE_BACKEND=CUDA" + ] ++ lib.optionals (!cudaSupport) [ + "-DUSE_BACKEND=OPENCL" + ] ++ lib.optionals useTcmalloc [ + "-DUSE_TCMALLOC=ON" + ]; + + preConfigure = '' + cd cpp/ + '' + lib.optionalString cudaSupport '' + export CUDA_PATH="${cudatoolkit}" + export EXTRA_LDFLAGS="-L/run/opengl-driver/lib" + ''; + + installPhase = '' + mkdir -p $out/bin; cp katago $out/bin; + '' + lib.optionalString cudaSupport '' + wrapProgram $out/bin/katago \ + --prefix LD_LIBRARY_PATH : "/run/opengl-driver/lib" + ''; + + enableParallelBuilding = true; + + meta = with stdenv.lib; { + description = "Go engine modeled after AlphaGo Zero"; + homepage = "https://github.com/lightvector/katago"; + license = licenses.mit; + maintainers = [ maintainers.omnipotententity ]; + platforms = [ "x86_64-linux" ]; + }; +} |