summary refs log tree commit diff
path: root/pkgs/servers/fishnet
diff options
context:
space:
mode:
authorRyan Burns <rtburns@protonmail.com>2021-09-18 19:56:43 -0700
committerRyan Burns <rtburns@protonmail.com>2021-09-18 20:05:46 -0700
commitf73f35b8c8967d851c3ef5da1862ed55aff448a1 (patch)
tree42575c3cfa42955abc6cae5dc30568d377f6f758 /pkgs/servers/fishnet
parent48bf1250a87792e993f875de8dac01134819b3c9 (diff)
downloadnixpkgs-f73f35b8c8967d851c3ef5da1862ed55aff448a1.tar
nixpkgs-f73f35b8c8967d851c3ef5da1862ed55aff448a1.tar.gz
nixpkgs-f73f35b8c8967d851c3ef5da1862ed55aff448a1.tar.bz2
nixpkgs-f73f35b8c8967d851c3ef5da1862ed55aff448a1.tar.lz
nixpkgs-f73f35b8c8967d851c3ef5da1862ed55aff448a1.tar.xz
nixpkgs-f73f35b8c8967d851c3ef5da1862ed55aff448a1.tar.zst
nixpkgs-f73f35b8c8967d851c3ef5da1862ed55aff448a1.zip
fishnet: 2.2.6 -> 2.4.0, fix build
fishnet-assets has been archived in favor of a submodule-based approach where
Stockfish and Fairy-Stockfish are built from source. This means we now need
to fetch the NNUE file, similar to Stockfish's standalone derivation.
Diffstat (limited to 'pkgs/servers/fishnet')
-rw-r--r--pkgs/servers/fishnet/assets.nix58
-rw-r--r--pkgs/servers/fishnet/default.nix25
2 files changed, 13 insertions, 70 deletions
diff --git a/pkgs/servers/fishnet/assets.nix b/pkgs/servers/fishnet/assets.nix
deleted file mode 100644
index b150e8ed637..00000000000
--- a/pkgs/servers/fishnet/assets.nix
+++ /dev/null
@@ -1,58 +0,0 @@
-{ lib
-, stdenv
-, fetchFromGitHub
-, xz
-, autoPatchelfHook }:
-
-# Assets for fishnet: A collection of pre-built compressed stockfish binaries.
-# We have to decompress them, patch them using auto-patchelf and compress them
-# again so that a selection of them can be embedded into the fishnet binary.
-stdenv.mkDerivation rec {
-  pname = "fishnet-assets";
-  version = "unstable-2020-03-27";
-
-  src = fetchFromGitHub {
-    owner = "niklasf";
-    repo = pname;
-    rev = "a1fe3ec6074ad9dc43e6d46e0d42fab5d7cce12c";
-    sha256 = "1548wj2bs89b5w42z3c98hpnbln5w8p1909wyl7a63d8vkvnyn5l";
-  };
-
-  relAssetsPath = "share/${pname}";
-
-  nativeBuildInputs = [ xz autoPatchelfHook ];
-
-  postPatch = ''
-    # Delete packed .exe files and all non .xz files (documentation and readme)
-    rm *.exe.xz
-    find \! -name "*.xz" -delete
-    # Extract .xz files, except *.nnue.xz
-    # We don't have to unpack the latter and it takes ages to repack
-    find -name "*.xz" \! -name "*.nnue.xz" | xargs unxz -v
-  '';
-
-  dontBuild = true;
-
-  installPhase = ''
-    mkdir -p $out/${relAssetsPath}
-    cp ./* $out/${relAssetsPath}
-  '';
-
-  preFixup = ''
-    gatherLibraries '${stdenv.cc.cc.lib}'
-  '';
-
-  doDist = true;
-  distPhase = ''
-    # repack assets
-    find $out/${relAssetsPath} -type f \! -name "*.xz" | xargs xz -v
-  '';
-
-  meta = with lib; {
-    description = "Assets for fishnet, only required during build";
-    homepage = "https://github.com/niklasf/fishnet-assets";
-    license = licenses.gpl3Only;
-    maintainers = with maintainers; [ tu-maurice ];
-    platforms = [ "x86_64-linux" ];
-  };
-}
diff --git a/pkgs/servers/fishnet/default.nix b/pkgs/servers/fishnet/default.nix
index be503567c56..784a5525133 100644
--- a/pkgs/servers/fishnet/default.nix
+++ b/pkgs/servers/fishnet/default.nix
@@ -2,33 +2,34 @@
 , stdenv
 , rustPlatform
 , fetchFromGitHub
-, xz
-, autoPatchelfHook }:
+, fetchurl
+}:
 
 let
-  assets = import ./assets.nix {
-    inherit lib stdenv fetchFromGitHub xz autoPatchelfHook;
+  nnueFile = "nn-6762d36ad265.nnue";
+  nnue = fetchurl {
+    url = "https://tests.stockfishchess.org/api/nn/${nnueFile}";
+    sha256 = "0727dsxfpns9fkyir95fybibqmigk5h45k154b2c5rk5s9md6qk7";
   };
 in
 rustPlatform.buildRustPackage rec {
   pname = "fishnet";
-  version = "2.2.6";
+  version = "2.4.0";
 
   src = fetchFromGitHub {
     owner = "niklasf";
     repo = pname;
     rev = "v${version}";
-    sha256 = "0dmc58wzv758b82pjpfzcfi0hr14hqcr61cd9v5xlgk5w78cisjq";
+    sha256 = "sha256-1Gl2vJFn9yVYH62yBJefAOBX/jJaFAdSZj2Lj3imcps=";
+    fetchSubmodules = true;
   };
 
-  cargoSha256 = "1s37b0w1aav6gz399zncfp0zqh5sfy0zmabhl7n8p5cwlmlvnlsj";
-
-  preBuild = ''
-    rmdir ./assets
-    ln -snf ${assets}/${assets.relAssetsPath} ./assets
+  postPatch = ''
+    cp -v '${nnue}' 'Stockfish/src/${nnueFile}'
+    cp -v '${nnue}' 'Fairy-Stockfish/src/${nnueFile}'
   '';
 
-  passthru.assets = assets;
+  cargoSha256 = "sha256-/s7Yyi2FUh+EDvgaHLgZ/FA6kk2FQrZr3L3B76fqTuc=";
 
   meta = with lib; {
     description = "Distributed Stockfish analysis for lichess.org";