depot/third_party/nixpkgs/pkgs/servers/blockbook/default.nix
Default email ce641f4048 Project import generated by Copybara.
GitOrigin-RevId: bc5d68306b40b8522ffb69ba6cff91898c2fbbff
2021-12-06 17:07:01 +01:00

71 lines
1.6 KiB
Nix

{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, pkg-config
, bzip2
, lz4
, rocksdb_6_23
, snappy
, zeromq
, zlib
, nixosTests
}:
let
rocksdb = rocksdb_6_23;
in
buildGoModule rec {
pname = "blockbook";
version = "0.3.6";
commit = "5f8cf45";
src = fetchFromGitHub {
owner = "trezor";
repo = "blockbook";
rev = "v${version}";
sha256 = "1jb195chy3kbspmv9vyg7llw6kgykkmvz3znd97mxf24f4q622jv";
};
vendorSha256 = "0d17qaqn33wi7lzw4hlym56d9v4qnmvs6plpm5jiby2g5yckq0mz";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ bzip2 lz4 rocksdb snappy zeromq zlib ];
ldflags = [
"-X github.com/trezor/blockbook/common.version=${version}"
"-X github.com/trezor/blockbook/common.gitcommit=${commit}"
"-X github.com/trezor/blockbook/common.buildDate=unknown"
];
tags = [ "rocksdb_6_16" ];
preBuild = lib.optionalString stdenv.isDarwin ''
ulimit -n 8192
'' + ''
export CGO_LDFLAGS="-L${stdenv.cc.cc.lib}/lib -lrocksdb -lz -lbz2 -lsnappy -llz4 -lm -lstdc++"
buildFlagsArray+=("-tags=${lib.concatStringsSep " " tags}")
buildFlagsArray+=("-ldflags=${lib.concatStringsSep " " ldflags}")
'';
subPackages = [ "." ];
postInstall = ''
mkdir -p $out/share/
cp -r $src/static/templates/ $out/share/
cp -r $src/static/css/ $out/share/
'';
passthru.tests = {
smoke-test = nixosTests.blockbook-frontend;
};
meta = with lib; {
description = "Trezor address/account balance backend";
homepage = "https://github.com/trezor/blockbook";
license = licenses.agpl3;
maintainers = with maintainers; [ mmahut _1000101 ];
platforms = platforms.unix;
};
}