Skip to content

Commit d51d20a

Browse files
committed
Add flake.nix
NixOS cannot execute the generic Linux `electrs` binary that the `electrsd` crate downloads for the integration tests. Provide a devshell that supplies bitcoind and a source-built Blockstream electrs from nixpkgs, along with `BITCOIND_EXE` and `ELECTRS_EXE` environment variables.
1 parent 056447c commit d51d20a

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
description = "ldk-node development environment";
3+
4+
inputs = {
5+
# Pinned to nixos-25.05: newer revisions of nixpkgs ship a
6+
# blockstream-electrs whose CLI moved from `--cookie-file` to `--cookie`,
7+
# This is a break in the `electrs` crate.
8+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
9+
flake-utils.url = "github:numtide/flake-utils";
10+
};
11+
12+
outputs = { self, nixpkgs, flake-utils }:
13+
flake-utils.lib.eachDefaultSystem (system:
14+
let
15+
pkgs = import nixpkgs {
16+
inherit system;
17+
# `blockstream-electrs` in this nixpkgs revision transitively pulls
18+
# in `python3.12-ecdsa-0.19.1`, which nixpkgs marks insecure.
19+
config.permittedInsecurePackages = [ "python3.12-ecdsa-0.19.1" ];
20+
};
21+
22+
# Upstream tests are failing. Skips the tests on install.
23+
blockstream-electrs = pkgs.blockstream-electrs.overrideAttrs (_: {
24+
doCheck = false;
25+
});
26+
in
27+
{
28+
devShells.default = pkgs.mkShell {
29+
packages = [
30+
pkgs.bitcoind
31+
blockstream-electrs
32+
];
33+
34+
shellHook = ''
35+
export BITCOIND_EXE="${pkgs.bitcoind}/bin/bitcoind"
36+
export ELECTRS_EXE="${blockstream-electrs}/bin/electrs"
37+
'';
38+
};
39+
});
40+
}

0 commit comments

Comments
 (0)