2019-07-20 03:21:16 +03:00
|
|
|
{ stdenv
|
2020-04-23 00:09:47 +03:00
|
|
|
, buildGoModule
|
2019-07-07 00:08:55 +03:00
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, rocksdb
|
|
|
|
, bzip2
|
|
|
|
, zlib
|
|
|
|
, packr
|
|
|
|
, snappy
|
|
|
|
, pkg-config
|
|
|
|
, zeromq
|
|
|
|
, lz4
|
|
|
|
}:
|
|
|
|
|
2020-04-23 00:09:47 +03:00
|
|
|
buildGoModule rec {
|
2019-07-07 00:08:55 +03:00
|
|
|
pname = "blockbook";
|
2020-06-14 13:27:47 +03:00
|
|
|
version = "0.3.4";
|
2020-06-15 14:56:54 +03:00
|
|
|
commit = "eb4e10a";
|
2019-07-07 00:08:55 +03:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "trezor";
|
|
|
|
repo = "blockbook";
|
|
|
|
rev = "v${version}";
|
2020-06-14 13:27:47 +03:00
|
|
|
sha256 = "0da1kav5x2xcmwvdgfk1q70l1k0sqqj3njgx2xx885d40m6qbnrs";
|
2019-07-07 00:08:55 +03:00
|
|
|
};
|
|
|
|
|
2020-05-01 04:59:00 +03:00
|
|
|
vendorSha256 = "1qjlvhizl8cy06cgf4phia70bgbm4lj57z5z2gyr8aglx98bnpdn";
|
2019-07-07 00:08:55 +03:00
|
|
|
|
|
|
|
buildInputs = [ bzip2 zlib snappy zeromq lz4 ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config packr ];
|
|
|
|
|
2020-04-23 00:09:47 +03: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
|
|
|
|
'';
|
|
|
|
|
2020-05-01 04:59:00 +03:00
|
|
|
goethereum = fetchFromGitHub {
|
|
|
|
owner = "ethereum";
|
|
|
|
repo = "go-ethereum";
|
|
|
|
rev = "v1.8.20";
|
|
|
|
sha256 = "0m2q1nz6f39pyr2rk6vflkwi4ykganzwr7wndpwr9rliw0x8jgi0";
|
|
|
|
};
|
|
|
|
|
|
|
|
overrideModAttrs = (_: {
|
|
|
|
postBuild = ''
|
|
|
|
rm -r vendor/github.com/ethereum/go-ethereum
|
|
|
|
cp -r --reflink=auto ${goethereum} vendor/github.com/ethereum/go-ethereum
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
2019-07-20 03:21:16 +03:00
|
|
|
preBuild = lib.optionalString stdenv.isDarwin ''
|
|
|
|
ulimit -n 8192
|
|
|
|
'' + ''
|
2019-07-07 00:08:55 +03:00
|
|
|
export CGO_CFLAGS="-I${rocksdb}/include"
|
|
|
|
export CGO_LDFLAGS="-L${rocksdb}/lib -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4"
|
|
|
|
packr clean && packr
|
|
|
|
'';
|
|
|
|
|
2020-04-27 13:16:16 +03:00
|
|
|
subPackages = [ "." ];
|
2019-07-07 00:08:55 +03:00
|
|
|
|
2020-06-23 14:04:57 +03:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $out/share/
|
|
|
|
cp -r $src/static/templates/ $out/share/
|
|
|
|
cp -r $src/static/css/ $out/share/
|
|
|
|
'';
|
|
|
|
|
2019-07-07 00:08:55 +03:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Trezor address/account balance backend";
|
|
|
|
homepage = "https://github.com/trezor/blockbook";
|
|
|
|
license = licenses.agpl3;
|
2020-04-23 00:09:47 +03:00
|
|
|
maintainers = with maintainers; [ mmahut maintainers."1000101" ];
|
2020-05-12 16:57:30 +03:00
|
|
|
platforms = remove "aarch64-linux" platforms.unix;
|
2019-07-07 00:08:55 +03:00
|
|
|
};
|
|
|
|
}
|