Skip to content

Commit

Permalink
ci: pin esplora
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Feb 13, 2024
1 parent dd1754c commit dd41a1c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 27 deletions.
17 changes: 0 additions & 17 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 6 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
# pinned to 0.26.0
# nixpkgs-bitcoind.url = "github:nixos/nixpkgs?rev=f5375ec98618347da6b036a5e06381ab7380db03";

# Blockstream's esplora
# inspired by fedimint CI
nixpkgs-kitman.url = "github:jkitman/nixpkgs?rev=61ccef8bc0a010a21ccdeb10a92220a47d8149ac";

rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
Expand All @@ -32,7 +28,7 @@
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
};

outputs = { self, nixpkgs, nixpkgs-bitcoind, nixpkgs-kitman, rust-overlay, flake-utils, pre-commit-hooks, ... }:
outputs = { self, nixpkgs, nixpkgs-bitcoind, rust-overlay, flake-utils, pre-commit-hooks, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
Expand All @@ -53,9 +49,9 @@
pkgs-bitcoind = import nixpkgs-bitcoind {
inherit system overlays;
};
pkgs-kitman = import nixpkgs-kitman {
inherit system;
};
pkgs-esplora = pkgs.callPackage ./nix/esplora.nix {
inherit (darwin.apple_sdk.frameworks) Security;
};

# Signed Commits
signed-commits = pkgs.writeShellApplication {
Expand Down Expand Up @@ -84,7 +80,7 @@
# Common inputs
envVars = {
BITCOIND_EXEC = "${pkgs-bitcoind.bitcoind}/bin/bitcoind";
ELECTRS_EXEC = "${pkgs-kitman.esplora}/bin/esplora";
ELECTRS_EXEC = "${pkgs-esplora}/bin/esplora";
CC = "${stdenv.cc.nativePrefix}cc";
AR = "${stdenv.cc.nativePrefix}ar";
CC_wasm32_unknown_unknown = "${pkgs.llvmPackages_14.clang-unwrapped}/bin/clang-14";
Expand All @@ -94,7 +90,7 @@
buildInputs = [
# Add additional build inputs here
pkgs-bitcoind.bitcoind
pkgs-kitman.esplora
pkgs-esplora
pkgs.openssl
pkgs.openssl.dev
pkgs.pkg-config
Expand Down
47 changes: 47 additions & 0 deletions nix/esplora.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, llvmPackages
, rocksdb_6_23
, Security
}:

let
rocksdb = rocksdb_6_23;
in
rustPlatform.buildRustPackage rec {
pname = "esplora";
# last tagged versoin is far behind master
version = "20230218";

src = fetchFromGitHub {
owner = "Blockstream";
repo = "electrs";
rev = "adedee15f1fe460398a7045b292604df2161adc0";
hash = "sha256-KnN5C7wFtDF10yxf+1dqIMUb8Q+UuCz4CMQrUFAChuA=";
};

cargoHash = "sha256-tM5IFiIYX2SlAp6Q5uccVjW6TgOf5MfoFrLXz3GlZ90=";

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

# link rocksdb dynamically
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";

buildInputs = lib.optionals stdenv.isDarwin [ Security ];

# rename to avoid a name conflict with other electrs package
postInstall = ''
mv $out/bin/electrs $out/bin/esplora
'';

meta = with lib; {
description = "Blockstream's re-implementation of Electrum Server for Esplora";
homepage = "https://github.com/Blockstream/electrs";
license = licenses.mit;
maintainers = with maintainers; [ jkitman ];
};
}

0 comments on commit dd41a1c

Please sign in to comment.