2021-06-16 16:50:41 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-22 23:09:47 +02:00
|
|
|
, buildGoModule
|
2019-07-06 23:08:55 +02:00
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
2020-07-18 16:48:56 +02:00
|
|
|
, bzip2
|
2019-07-06 23:08:55 +02:00
|
|
|
, lz4
|
2021-11-14 00:22:26 +01:00
|
|
|
, rocksdb_6_23
|
2020-07-18 16:48:56 +02:00
|
|
|
, snappy
|
|
|
|
, zeromq
|
|
|
|
, zlib
|
2021-04-04 00:32:37 +02:00
|
|
|
, nixosTests
|
2019-07-06 23:08:55 +02:00
|
|
|
}:
|
|
|
|
|
2021-11-14 00:22:26 +01:00
|
|
|
let
|
|
|
|
rocksdb = rocksdb_6_23;
|
|
|
|
in
|
2020-04-22 23:09:47 +02:00
|
|
|
buildGoModule rec {
|
2019-07-06 23:08:55 +02:00
|
|
|
pname = "blockbook";
|
2021-06-16 16:50:41 +02:00
|
|
|
version = "0.3.6";
|
|
|
|
commit = "5f8cf45";
|
2019-07-06 23:08:55 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "trezor";
|
|
|
|
repo = "blockbook";
|
|
|
|
rev = "v${version}";
|
2021-06-16 16:50:41 +02:00
|
|
|
sha256 = "1jb195chy3kbspmv9vyg7llw6kgykkmvz3znd97mxf24f4q622jv";
|
2019-07-06 23:08:55 +02:00
|
|
|
};
|
|
|
|
|
2022-01-30 20:26:51 +01:00
|
|
|
vendorSha256 = "1w9c0qzah2f9rbjdxqajwrfkia25cwbn30gidviaid3b7ddpd7r8";
|
2019-07-06 23:08:55 +02:00
|
|
|
|
2021-06-16 16:50:41 +02:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2019-07-06 23:08:55 +02:00
|
|
|
|
2020-07-18 16:48:56 +02:00
|
|
|
buildInputs = [ bzip2 lz4 rocksdb snappy zeromq zlib ];
|
2019-07-06 23:08:55 +02:00
|
|
|
|
2021-08-26 08:45:51 +02:00
|
|
|
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"
|
|
|
|
];
|
2020-04-22 23:09:47 +02:00
|
|
|
|
2021-06-16 16:50:41 +02:00
|
|
|
tags = [ "rocksdb_6_16" ];
|
|
|
|
|
2021-01-15 08:07:56 +01:00
|
|
|
preBuild = lib.optionalString stdenv.isDarwin ''
|
2019-07-20 02:21:16 +02:00
|
|
|
ulimit -n 8192
|
|
|
|
'' + ''
|
2020-07-18 16:48:56 +02:00
|
|
|
export CGO_LDFLAGS="-L${stdenv.cc.cc.lib}/lib -lrocksdb -lz -lbz2 -lsnappy -llz4 -lm -lstdc++"
|
2021-06-16 16:50:41 +02:00
|
|
|
buildFlagsArray+=("-tags=${lib.concatStringsSep " " tags}")
|
|
|
|
buildFlagsArray+=("-ldflags=${lib.concatStringsSep " " ldflags}")
|
2019-07-06 23:08:55 +02:00
|
|
|
'';
|
|
|
|
|
2020-04-27 12:16:16 +02:00
|
|
|
subPackages = [ "." ];
|
2019-07-06 23:08:55 +02:00
|
|
|
|
2020-06-23 13:04:57 +02:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/
|
|
|
|
cp -r $src/static/templates/ $out/share/
|
|
|
|
cp -r $src/static/css/ $out/share/
|
|
|
|
'';
|
|
|
|
|
2021-04-04 00:32:37 +02:00
|
|
|
passthru.tests = {
|
|
|
|
smoke-test = nixosTests.blockbook-frontend;
|
|
|
|
};
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-07-06 23:08:55 +02:00
|
|
|
description = "Trezor address/account balance backend";
|
|
|
|
homepage = "https://github.com/trezor/blockbook";
|
|
|
|
license = licenses.agpl3;
|
2020-07-29 12:57:20 +02:00
|
|
|
maintainers = with maintainers; [ mmahut _1000101 ];
|
2020-07-18 16:48:56 +02:00
|
|
|
platforms = platforms.unix;
|
2019-07-06 23:08:55 +02:00
|
|
|
};
|
|
|
|
}
|