Skip to content

Commit 5a7e1fe

Browse files
committed
flake-parts: set up basic boilerplate
- add a modified bitcoin-core flake (from willcl-ark nix-dev-server) - compose this with a rust-bitcoinkernel flake - setup for macos/linux
1 parent 5668668 commit 5a7e1fe

File tree

6 files changed

+196
-0
lines changed

6 files changed

+196
-0
lines changed

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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
description = "devazoa - a collection of bitcoin development environments";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/24.11";
6+
flake-parts.url = "github:hercules-ci/flake-parts";
7+
};
8+
9+
outputs = inputs@{ flake-parts, ... }:
10+
flake-parts.lib.mkFlake { inherit inputs; } {
11+
imports = [
12+
./modules/devshells.nix
13+
./modules/formatter.nix
14+
];
15+
};
16+
}

modules/devshells.nix

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{ lib, ... }:
2+
3+
{
4+
systems = [
5+
"x86_64-linux"
6+
"aarch64-darwin"
7+
];
8+
9+
perSystem = { system, pkgs, ... }: {
10+
devShells = {
11+
default = pkgs.mkShell {
12+
packages = with pkgs; [ nix git ];
13+
};
14+
15+
bitcoin-core = import ../shells/bitcoin-core.nix { inherit pkgs system; };
16+
rust-bitcoinkernel = import ../shells/rust-bitcoinkernel.nix { inherit pkgs system; };
17+
};
18+
};
19+
}

modules/formatter.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{ lib, ... }:
2+
3+
{
4+
perSystem = { pkgs, ... }: {
5+
formatter = pkgs.nixpkgs-fmt;
6+
};
7+
}

shells/bitcoin-core.nix

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{ pkgs, system }:
2+
3+
let
4+
isLinux = pkgs.stdenv.isLinux;
5+
lib = pkgs.lib;
6+
7+
commonNativeBuildInputs = with pkgs; [
8+
byacc
9+
ccache
10+
clang-tools_19
11+
clang_19
12+
cmake
13+
gcc14
14+
gnum4
15+
gnumake
16+
ninja
17+
pkg-config
18+
qt6.wrapQtAppsHook
19+
];
20+
21+
linuxNativeBuildInputs = with pkgs; [
22+
libsystemtap
23+
linuxPackages.bcc
24+
linuxPackages.bpftrace
25+
python312Packages.bcc
26+
];
27+
28+
nativeBuildInputs = commonNativeBuildInputs ++ (if isLinux then linuxNativeBuildInputs else [ ]);
29+
30+
pythonEnv = pkgs.python312.withPackages (ps: with ps; [
31+
flake8
32+
lief
33+
mypy
34+
pyzmq
35+
vulture
36+
]);
37+
38+
commonBuildInputs = with pkgs; [
39+
boost
40+
capnproto
41+
codespell
42+
db4
43+
hexdump
44+
libevent
45+
qrencode
46+
qt6.qtbase
47+
qt6.qttools
48+
sqlite
49+
uv
50+
zeromq
51+
pythonEnv
52+
];
53+
54+
linuxBuildInputs = with pkgs; [ python312Packages.bcc ];
55+
56+
buildInputs = commonBuildInputs ++ (if isLinux then linuxBuildInputs else [ ]);
57+
58+
shellHook = ''
59+
export CC=clang
60+
export CXX=clang++
61+
export CMAKE_GENERATOR=Ninja
62+
'';
63+
in
64+
65+
pkgs.mkShell {
66+
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.gcc14.cc pkgs.capnproto ];
67+
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
68+
QT_PLUGIN_PATH = "${pkgs.qt6.qtbase}/${pkgs.qt6.qtbase.qtPluginPrefix}";
69+
inherit nativeBuildInputs buildInputs shellHook;
70+
}

shells/rust-bitcoinkernel.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{ pkgs, system }:
2+
3+
let
4+
bitcoinCoreShell = import ./bitcoin-core.nix { inherit pkgs system; };
5+
in
6+
7+
pkgs.mkShell {
8+
nativeBuildInputs = bitcoinCoreShell.nativeBuildInputs ++ (with pkgs; [
9+
rustc
10+
cargo
11+
clippy
12+
rustfmt
13+
llvmPackages_19.libclang
14+
]);
15+
16+
buildInputs = bitcoinCoreShell.buildInputs;
17+
18+
shellHook = ''
19+
${bitcoinCoreShell.shellHook}
20+
21+
export LIBCLANG_PATH="${pkgs.llvmPackages_19.libclang.lib}/lib"
22+
'';
23+
}

0 commit comments

Comments
 (0)