nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1new_src="$(nix-build --attr "pkgs.$PNAME.src" --no-out-link)"
2new_nnue_big_file="$(grep --perl-regexp --only-matching 'EvalFileDefaultNameBig "\Knn-(\w+).nnue' "$new_src/src/evaluate.h")"
3new_nnue_small_file="$(grep --perl-regexp --only-matching 'EvalFileDefaultNameSmall "\Knn-(\w+).nnue' "$new_src/src/evaluate.h")"
4new_nnue_big_hash="$(
5 nix --extra-experimental-features nix-command hash convert --hash-algo sha256 "$(
6 nix-prefetch-url --type sha256 "https://tests.stockfishchess.org/api/nn/$new_nnue_big_file"
7 )"
8)"
9new_nnue_small_hash="$(
10 nix --extra-experimental-features nix-command hash convert --hash-algo sha256 "$(
11 nix-prefetch-url --type sha256 "https://tests.stockfishchess.org/api/nn/$new_nnue_small_file"
12 )"
13)"
14
15pkg_body="$(<"$PKG_FILE")"
16pkg_body="${pkg_body//"$NNUE_BIG_FILE"/"$new_nnue_big_file"}"
17pkg_body="${pkg_body//"$NNUE_BIG_HASH"/"$new_nnue_big_hash"}"
18pkg_body="${pkg_body//"$NNUE_SMALL_FILE"/"$new_nnue_small_file"}"
19pkg_body="${pkg_body//"$NNUE_SMALL_HASH"/"$new_nnue_small_hash"}"
20echo "$pkg_body" >"$PKG_FILE"