4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
65 lines
1.4 KiB
Nix
65 lines
1.4 KiB
Nix
{ lib, stdenv
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, packr
|
|
, pkg-config
|
|
, bzip2
|
|
, lz4
|
|
, rocksdb
|
|
, snappy
|
|
, zeromq
|
|
, zlib
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "blockbook";
|
|
version = "0.3.4";
|
|
commit = "eb4e10a";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "trezor";
|
|
repo = "blockbook";
|
|
rev = "v${version}";
|
|
sha256 = "0da1kav5x2xcmwvdgfk1q70l1k0sqqj3njgx2xx885d40m6qbnrs";
|
|
};
|
|
|
|
runVend = true;
|
|
vendorSha256 = "0p7vyw61nwvmaz7gz2bdh9fi6wp62i2vnzw6iz2r8cims4sbz53b";
|
|
|
|
doCheck = false;
|
|
|
|
nativeBuildInputs = [ packr pkg-config ];
|
|
|
|
buildInputs = [ bzip2 lz4 rocksdb snappy zeromq zlib ];
|
|
|
|
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
|
|
'';
|
|
|
|
preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
|
|
ulimit -n 8192
|
|
'' + ''
|
|
export CGO_LDFLAGS="-L${stdenv.cc.cc.lib}/lib -lrocksdb -lz -lbz2 -lsnappy -llz4 -lm -lstdc++"
|
|
packr clean && packr
|
|
'';
|
|
|
|
subPackages = [ "." ];
|
|
|
|
postInstall = ''
|
|
mkdir -p $out/share/
|
|
cp -r $src/static/templates/ $out/share/
|
|
cp -r $src/static/css/ $out/share/
|
|
'';
|
|
|
|
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;
|
|
};
|
|
}
|