nixpkgs/pkgs/servers/blockbook/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

82 lines
1.6 KiB
Nix

{ lib
, buildGoModule
, bzip2
, fetchFromGitHub
, lz4
, nixosTests
, pkg-config
, rocksdb_7_10
, snappy
, stdenv
, zeromq
, zlib
}:
let
rocksdb = rocksdb_7_10;
in
buildGoModule rec {
pname = "blockbook";
version = "0.4.0";
commit = "b227dfe";
src = fetchFromGitHub {
owner = "trezor";
repo = "blockbook";
rev = "v${version}";
hash = "sha256-98tp3QYaHfhVIiJ4xkA3bUanXwK1q05t+YNroFtBUxE=";
};
proxyVendor = true;
vendorHash = "sha256-n03eWWy+58KAbYnKxI3/ulWIpmR+ivtImQSqbe2kpYU=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ bzip2 lz4 rocksdb snappy zeromq zlib ];
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"
];
tags = [ "rocksdb_7_10" ];
CGO_LDFLAGS = [
"-L${stdenv.cc.cc.lib}/lib"
"-lrocksdb"
"-lz"
"-lbz2"
"-lsnappy"
"-llz4"
"-lm"
"-lstdc++"
];
preBuild = lib.optionalString stdenv.hostPlatform.isDarwin ''
ulimit -n 8192
'';
subPackages = [ "." ];
postInstall = ''
mkdir -p $out/share/
cp -r $src/static/templates/ $out/share/
cp -r $src/static/css/ $out/share/
'';
passthru.tests = {
smoke-test = nixosTests.blockbook-frontend;
};
meta = with lib; {
description = "Trezor address/account balance backend";
homepage = "https://github.com/trezor/blockbook";
license = licenses.agpl3Only;
maintainers = with maintainers; [ mmahut _1000101 ];
platforms = platforms.unix;
mainProgram = "blockbook";
};
}