nixpkgs/pkgs/games/stockfish/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
2.2 KiB
Nix
Raw Normal View History

2021-07-04 05:25:25 +01:00
{ lib, stdenv, fetchurl, fetchFromGitHub }:
2021-02-12 21:54:26 +00:00
let
# The x86-64-modern may need to be refined further in the future
# but stdenv.hostPlatform CPU flags do not currently work on Darwin
# https://discourse.nixos.org/t/darwin-system-and-stdenv-hostplatform-features/9745
archDarwin = if stdenv.hostPlatform.isx86_64 then "x86-64-modern" else "apple-silicon";
arch = if stdenv.hostPlatform.isDarwin then archDarwin else
if stdenv.hostPlatform.isx86_64 then "x86-64" else
if stdenv.hostPlatform.isi686 then "x86-32" else
if stdenv.hostPlatform.isAarch64 then "armv8" else
2016-05-08 14:10:36 +01:00
"unknown";
2020-09-23 21:31:56 +01:00
# These files can be found in src/evaluate.h
2024-09-08 10:13:09 +01:00
nnueBigFile = "nn-1111cefa1111.nnue";
nnueBig = fetchurl {
name = nnueBigFile;
url = "https://tests.stockfishchess.org/api/nn/${nnueBigFile}";
2024-09-08 10:13:09 +01:00
sha256 = "sha256-ERHO+hERa3cWG9SxTatMUPJuWSDHVvSGFZK+Pc1t4XQ=";
};
2024-09-08 10:13:09 +01:00
nnueSmallFile = "nn-37f18f62d772.nnue";
nnueSmall = fetchurl {
name = nnueSmallFile;
url = "https://tests.stockfishchess.org/api/nn/${nnueSmallFile}";
2024-09-08 10:13:09 +01:00
sha256 = "sha256-N/GPYtdy8xB+HWqso4mMEww8hvKrY+ZVX7vKIGNaiZ0=";
2020-09-23 21:31:56 +01:00
};
2016-05-08 14:10:36 +01:00
in
2021-07-04 05:25:25 +01:00
stdenv.mkDerivation rec {
2019-08-13 22:52:01 +01:00
pname = "stockfish";
2024-09-08 10:13:09 +01:00
version = "17";
2016-05-08 14:10:36 +01:00
2021-07-04 05:25:25 +01:00
src = fetchFromGitHub {
owner = "official-stockfish";
repo = "Stockfish";
rev = "sf_${version}";
2024-09-08 10:13:09 +01:00
sha256 = "sha256-oXvLaC5TEUPlHjhm7tOxpNPY88QxYHFw+Cev3Q8NEeQ=";
2015-12-14 10:17:02 +00:00
};
2016-05-08 14:10:36 +01:00
2020-09-23 21:31:56 +01:00
postUnpack = ''
sourceRoot+=/src
cp "${nnueBig}" "$sourceRoot/${nnueBigFile}"
cp "${nnueSmall}" "$sourceRoot/${nnueSmallFile}"
2020-09-23 21:31:56 +01:00
'';
2021-02-12 21:54:26 +00:00
makeFlags = [ "PREFIX=$(out)" "ARCH=${arch}" "CXX=${stdenv.cc.targetPrefix}c++" ];
buildFlags = [ "build" ];
2016-05-08 14:10:36 +01:00
2015-12-14 10:17:02 +00:00
enableParallelBuilding = true;
2016-05-08 14:10:36 +01:00
2021-07-04 05:25:25 +01:00
meta = with lib; {
homepage = "https://stockfishchess.org/";
2015-12-14 10:17:02 +00:00
description = "Strong open source chess engine";
mainProgram = "stockfish";
2015-12-14 10:17:02 +00:00
longDescription = ''
Stockfish is one of the strongest chess engines in the world. It is also
much stronger than the best human chess grandmasters.
'';
2024-09-08 10:13:09 +01:00
maintainers = with maintainers; [ luispedro siraben thibaultd ];
2024-02-23 03:43:14 +00:00
platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
2021-11-11 16:42:02 +00:00
license = licenses.gpl3Only;
2015-12-14 10:17:02 +00:00
};
2016-05-08 14:10:36 +01:00
2015-12-14 10:17:02 +00:00
}