summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authorMichele Guerini Rocco <rnhmjoj@users.noreply.github.com>2020-03-31 09:41:02 +0200
committerGitHub <noreply@github.com>2020-03-31 09:41:02 +0200
commit9cc33722565d4bcb90965e2c83887411d2e40ebe (patch)
tree441eda88f68b20da83f39054b93099747b38e032 /pkgs
parent8ef96116456236d5b94480ac084454058d18bb5e (diff)
parentdc3a76ae0ae6ae75ca29f1e8f8b9f3aceec5f7b5 (diff)
Merge pull request #82082 from OmnipotentEntity/katago-init
katago: init at 1.3.5
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/games/katago/default.nix97
-rw-r--r--pkgs/top-level/all-packages.nix8
2 files changed, 105 insertions, 0 deletions
diff --git a/pkgs/games/katago/default.nix b/pkgs/games/katago/default.nix
new file mode 100644
index 000000000000..cbbdb538513c
--- /dev/null
+++ b/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" ];
+ };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index dee871b0898f..af7ca0e2cf17 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -23482,6 +23482,14 @@ in
ja2-stracciatella = callPackage ../games/ja2-stracciatella { };
+ katago = callPackage ../games/katago { };
+
+ katagoWithCuda = katago.override {
+ cudaSupport = true;
+ cudnn = cudnn_cudatoolkit_10_1;
+ cudatoolkit = cudatoolkit_10_1;
+ };
+
klavaro = callPackage ../games/klavaro {};
kobodeluxe = callPackage ../games/kobodeluxe { };