Skip to content

Commit

Permalink
blockstream-electrs: init at 0.4.1-unstable-2024-11-25 (#318195)
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegendeWurst authored Dec 11, 2024
2 parents 615e67b + 5ae74b8 commit f4cee62
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions pkgs/by-name/bl/blockstream-electrs/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
bitcoind,
electrum,
fetchFromGitHub,
lib,
rocksdb_8_3,
rustPlatform,
stdenv,
}:

rustPlatform.buildRustPackage rec {
pname = "blockstream-electrs";
version = "0.4.1-unstable-2024-11-25";

src = fetchFromGitHub {
owner = "Blockstream";
repo = "electrs";
rev = "680eacaa8360d5f46eaae9611a3097ba183795c6";
hash = "sha256-oDM4arH3aplgcS49t/hy5Rqt36glrVufd3F4tw3j1zo=";
};

useFetchCargoVendor = true;
cargoHash = "sha256-X2C69ui3XiYP1cg9FgfBbJlLLMq1SCw+oAL20B1Fs30=";

nativeBuildInputs = [
# Needed for librocksdb-sys
rustPlatform.bindgenHook
];

env = {
# Dynamically link rocksdb
ROCKSDB_INCLUDE_DIR = "${rocksdb_8_3}/include";
ROCKSDB_LIB_DIR = "${rocksdb_8_3}/lib";

# External binaries for integration tests are provided via nixpkgs. Skip
# trying to download them.
BITCOIND_SKIP_DOWNLOAD = true;
ELECTRUMD_SKIP_DOWNLOAD = true;
ELEMENTSD_SKIP_DOWNLOAD = true;
};

# Only build the service
cargoBuildFlags = [
"--package=electrs"
"--bin=electrs"
];

# Some upstream dev-dependencies (electrumd, elementsd) currently fail to
# build on non-x86_64-linux platforms, even if downloading is skipped.
# TODO(phlip9): submit a PR to fix this
doCheck = stdenv.hostPlatform.system == "x86_64-linux";

# Build tests in debug mode to reduce build time
checkType = "debug";

# Integration tests require us to pass in some external deps via env.
preCheck = lib.optionalString doCheck ''
export BITCOIND_EXE=${bitcoind}/bin/bitcoind
export ELECTRUMD_EXE=${electrum}/bin/electrum
'';

# Make sure the final binary actually runs
doInstallCheck = true;
installCheckPhase = ''
$out/bin/electrs --version
'';

meta = {
description = "Efficient re-implementation of Electrum Server in Rust";
longDescription = ''
A blockchain index engine and HTTP API written in Rust based on
[romanz/electrs](https://github.com/romanz/electrs).
Used as the backend for the [Esplora block explorer](https://github.com/Blockstream/esplora)
powering <https://blockstream.info>.
API documentation [is available here](https://github.com/blockstream/esplora/blob/master/API.md).
Documentation for the database schema and indexing process [is available here](https://github.com/Blockstream/electrs/blob/new-index/doc/schema.md).
'';
homepage = "https://github.com/Blockstream/electrs";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ phlip9 ];
mainProgram = "electrs";
};
}

0 comments on commit f4cee62

Please sign in to comment.