diff options
author | tu-maurice <valentin.gehrke@zom.bi> | 2021-01-27 20:01:09 +0100 |
---|---|---|
committer | tu-maurice <valentin.gehrke@zom.bi> | 2021-02-01 19:26:18 +0100 |
commit | b7d912894c1d12e99d1f7cd8b7ef55fc2a579d16 (patch) | |
tree | 865213d99fe32bf8e29eaf933bb37f2f055fa9bf | |
parent | 0b5fd3b7847445f3683ff60c8b896a7f2adc3b0e (diff) |
fishnet: init at 2.2.3
-rw-r--r-- | pkgs/servers/fishnet/assets.nix | 57 | ||||
-rw-r--r-- | pkgs/servers/fishnet/default.nix | 37 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
3 files changed, 96 insertions, 0 deletions
diff --git a/pkgs/servers/fishnet/assets.nix b/pkgs/servers/fishnet/assets.nix new file mode 100644 index 0000000000000..6844db1b810c1 --- /dev/null +++ b/pkgs/servers/fishnet/assets.nix @@ -0,0 +1,57 @@ +{ 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-01-30"; + + src = fetchFromGitHub { + owner = "niklasf"; + repo = pname; + rev = "b4fa30e57ec8976fb1c10bd36737bc784351b93e"; + sha256 = "0gfs9lm4ih3h3fmgqylw05ii1h0d6mpjfxadnw3wymnjsspfb0m4"; + }; + + 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 ]; + }; +} diff --git a/pkgs/servers/fishnet/default.nix b/pkgs/servers/fishnet/default.nix new file mode 100644 index 0000000000000..2aa46b7d825ce --- /dev/null +++ b/pkgs/servers/fishnet/default.nix @@ -0,0 +1,37 @@ +{ lib +, stdenv +, rustPlatform +, fetchFromGitHub +, xz +, autoPatchelfHook }: + +let + assets = import ./assets.nix { + inherit lib stdenv fetchFromGitHub xz autoPatchelfHook; + }; +in +rustPlatform.buildRustPackage rec { + pname = "fishnet"; + version = "2.2.3"; + + src = fetchFromGitHub { + owner = "niklasf"; + repo = pname; + rev = "v${version}"; + sha256 = "159fwjy70n6lvnhdwv65azgi03r5qcc2m2zpzgz0k3r6cy06faxj"; + }; + + cargoSha256 = "1bfs8dy08799r6d63sb33zwcxas3gzp7jvcxv3w8n64gffan8f2n"; + + preBuild = '' + rmdir ./assets + ln -snf ${assets}/${assets.relAssetsPath} ./assets + ''; + + meta = with lib; { + description = "Distributed Stockfish analysis for lichess.org"; + homepage = "https://github.com/niklasf/fishnet"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ tu-maurice ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bd3f5e27d31c3..3ba27c3d64b80 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -152,6 +152,8 @@ in fiche = callPackage ../servers/fiche { }; + fishnet = callPackage ../servers/fishnet { }; + avro-tools = callPackage ../development/tools/avro-tools { }; bacnet-stack = callPackage ../tools/networking/bacnet-stack {}; |