2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv
|
2020-04-22 22:09:47 +01:00
|
|
|
, buildGoModule
|
2019-07-06 22:08:55 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, packr
|
|
|
|
, pkg-config
|
2020-07-18 15:48:56 +01:00
|
|
|
, bzip2
|
2019-07-06 22:08:55 +01:00
|
|
|
, lz4
|
2020-07-18 15:48:56 +01:00
|
|
|
, rocksdb
|
|
|
|
, snappy
|
|
|
|
, zeromq
|
|
|
|
, zlib
|
2021-04-03 23:32:37 +01:00
|
|
|
, nixosTests
|
2019-07-06 22:08:55 +01:00
|
|
|
}:
|
|
|
|
|
2020-04-22 22:09:47 +01:00
|
|
|
buildGoModule rec {
|
2019-07-06 22:08:55 +01:00
|
|
|
pname = "blockbook";
|
2020-06-14 11:27:47 +01:00
|
|
|
version = "0.3.4";
|
2020-06-15 12:56:54 +01:00
|
|
|
commit = "eb4e10a";
|
2019-07-06 22:08:55 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "trezor";
|
|
|
|
repo = "blockbook";
|
|
|
|
rev = "v${version}";
|
2020-06-14 11:27:47 +01:00
|
|
|
sha256 = "0da1kav5x2xcmwvdgfk1q70l1k0sqqj3njgx2xx885d40m6qbnrs";
|
2019-07-06 22:08:55 +01:00
|
|
|
};
|
|
|
|
|
2020-06-04 03:56:51 +01:00
|
|
|
runVend = true;
|
|
|
|
vendorSha256 = "0p7vyw61nwvmaz7gz2bdh9fi6wp62i2vnzw6iz2r8cims4sbz53b";
|
2019-07-06 22:08:55 +01:00
|
|
|
|
2020-08-04 01:26:27 +01:00
|
|
|
doCheck = false;
|
|
|
|
|
2020-07-18 15:48:56 +01:00
|
|
|
nativeBuildInputs = [ packr pkg-config ];
|
2019-07-06 22:08:55 +01:00
|
|
|
|
2020-07-18 15:48:56 +01:00
|
|
|
buildInputs = [ bzip2 lz4 rocksdb snappy zeromq zlib ];
|
2019-07-06 22:08:55 +01:00
|
|
|
|
2020-04-22 22:09:47 +01:00
|
|
|
buildFlagsArray = ''
|
|
|
|
-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
|
|
|
|
'';
|
|
|
|
|
2021-01-15 07:07:56 +00:00
|
|
|
preBuild = lib.optionalString stdenv.isDarwin ''
|
2019-07-20 01:21:16 +01:00
|
|
|
ulimit -n 8192
|
|
|
|
'' + ''
|
2020-07-18 15:48:56 +01:00
|
|
|
export CGO_LDFLAGS="-L${stdenv.cc.cc.lib}/lib -lrocksdb -lz -lbz2 -lsnappy -llz4 -lm -lstdc++"
|
2019-07-06 22:08:55 +01:00
|
|
|
packr clean && packr
|
|
|
|
'';
|
|
|
|
|
2020-04-27 11:16:16 +01:00
|
|
|
subPackages = [ "." ];
|
2019-07-06 22:08:55 +01:00
|
|
|
|
2020-06-23 12:04:57 +01:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/
|
|
|
|
cp -r $src/static/templates/ $out/share/
|
|
|
|
cp -r $src/static/css/ $out/share/
|
|
|
|
'';
|
|
|
|
|
2021-04-03 23:32:37 +01:00
|
|
|
passthru.tests = {
|
|
|
|
smoke-test = nixosTests.blockbook-frontend;
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-07-06 22:08:55 +01:00
|
|
|
description = "Trezor address/account balance backend";
|
|
|
|
homepage = "https://github.com/trezor/blockbook";
|
|
|
|
license = licenses.agpl3;
|
2020-07-29 11:57:20 +01:00
|
|
|
maintainers = with maintainers; [ mmahut _1000101 ];
|
2020-07-18 15:48:56 +01:00
|
|
|
platforms = platforms.unix;
|
2021-05-17 16:14:43 +01:00
|
|
|
# go dependency tecbot/gorocksdb requires rocksdb 5.x but nixpkgs has only rocksdb 6.x
|
|
|
|
# issue in upstream can be tracked here: https://github.com/trezor/blockbook/issues/617
|
|
|
|
broken = true;
|
2019-07-06 22:08:55 +01:00
|
|
|
};
|
|
|
|
}
|