nixpkgs/pkgs/servers/blockbook/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

72 lines
1.6 KiB
Nix
Raw Normal View History

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