about summary refs log tree commit diff
path: root/pkgs/by-name/lc/lc0/package.nix
blob: 4ccb1927534bf9306a791af4904a5636769b00e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{ stdenv
, lib
, fetchFromGitHub
, meson
, ninja
, pkg-config
, python3
, zlib
, gtest
, eigen
}:

stdenv.mkDerivation rec {
  pname = "lc0";
  version = "0.30.0";

  src = fetchFromGitHub {
    owner = "LeelaChessZero";
    repo = "lc0";
    rev = "refs/tags/v${version}";
    hash = "sha256-Q85hXNSexHhk6W48tgJLk0Sf32xBipfg2P2SH1FF89Q=";
    fetchSubmodules = true;
  };

  patchPhase = ''
    runHook prePatch

    patchShebangs --build /build/source/scripts/*

    runHook postPatch
  '';

  strictDeps = true;

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
    python3
  ];

  buildInputs = [
    eigen
    gtest
    zlib
  ];

  mesonFlags = [
    "-Dplain_cuda=false"
    "-Daccelerate=false"
    "-Dmetal=disabled"
    "-Dembed=false"
  ]
  # in version 31 this option will be required
  ++ lib.optionals (lib.versionAtLeast version "0.31") [ "-Dnative_cuda=false" ];


  enableParallelBuilding = true;

  meta = {
    homepage = "https://lczero.org/";
    description = "Open source neural network based chess engine";
    longDescription = ''
      Lc0 is a UCI-compliant chess engine designed to play chess via neural network, specifically those of the LeelaChessZero project.
    '';
    maintainers = with lib.maintainers; [ _9glenda ];
    platforms = lib.platforms.unix;
    license = lib.licenses.gpl3Plus;
    broken = stdenv.hostPlatform.isDarwin;
  };

}