diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-02-16 18:32:21 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-02-16 18:32:21 +0000 |
commit | 9becdcc5df71b47a5da84ad670e9a7eae9e0c65a (patch) | |
tree | 2ddf0335eb393f89501e3753b50c3f7ab0552d12 /nixpkgs/pkgs/servers/fishnet | |
parent | 49f2a77ac9abc88c253f68952eda26557fc3b555 (diff) | |
parent | ff96a0fa5635770390b184ae74debea75c3fd534 (diff) | |
download | nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.gz nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.bz2 nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.lz nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.xz nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.tar.zst nixlib-9becdcc5df71b47a5da84ad670e9a7eae9e0c65a.zip |
nixpkgs: merge nixos-unstable
Diffstat (limited to 'nixpkgs/pkgs/servers/fishnet')
-rw-r--r-- | nixpkgs/pkgs/servers/fishnet/assets.nix | 57 | ||||
-rw-r--r-- | nixpkgs/pkgs/servers/fishnet/default.nix | 37 |
2 files changed, 94 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/fishnet/assets.nix b/nixpkgs/pkgs/servers/fishnet/assets.nix new file mode 100644 index 000000000000..6844db1b810c --- /dev/null +++ b/nixpkgs/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/nixpkgs/pkgs/servers/fishnet/default.nix b/nixpkgs/pkgs/servers/fishnet/default.nix new file mode 100644 index 000000000000..508068bd2d4b --- /dev/null +++ b/nixpkgs/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.4"; + + src = fetchFromGitHub { + owner = "niklasf"; + repo = pname; + rev = "v${version}"; + sha256 = "19dh69b6mqx16195w9d20fah4jl8hhbxm84xq4zwsgl4khmw7zqz"; + }; + + cargoSha256 = "0zl2fnmqncyjd52wkn6dddx9lm9ywpw7swy895yq299z2bbbkv3h"; + + 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 ]; + }; +} |