Skip to content

Instantly share code, notes, and snippets.

@0xB10C
Last active March 28, 2024 16:35
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save 0xB10C/1fd0d4a68bf96914775b1515340926f8 to your computer and use it in GitHub Desktop.
Save 0xB10C/1fd0d4a68bf96914775b1515340926f8 to your computer and use it in GitHub Desktop.
Nix shell for Bitcoin Core development (moved to https://github.com/0xB10C/nix-bitcoin-core)
# MOVED:
# To enable better collboration, I've moved the shell.nix to https://github.com/0xB10C/nix-bitcoin-core.
# Older revisions remain avaiable here.
# https://gist.github.com/0xB10C/1fd0d4a68bf96914775b1515340926f8/revisions
#
#
#
#
#
#
#
{ pkgs ? import <nixpkgs> {} }:
#pkgs.clangStdenv.mkDerivation {
# name = "libcxxStdenv";
# clang_13
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
autoconf
automake
libtool
pkg-config
boost
libevent
zeromq
sqlite
db48
clang_13
# tests
hexdump
# for newer cmake building
cmake
# depends
byacc
# only needed for older versions
# openssl
# functional tests
python3
python3Packages.flake8
python3Packages.autopep8
python3Packages.mypy
python3Packages.requests
python3Packages.pyzmq
# benchmarking
python3Packages.pyperf
# debugging
gdb
# tracing
libsystemtap
linuxPackages.bpftrace
linuxPackages.bcc
];
# needed in 'autogen.sh'
LIBTOOLIZE = "libtoolize";
# needed for 'configure' to find boost
# Run ./configure with the argument '--with-boost-libdir=\$NIX_BOOST_LIB_DIR'"
NIX_BOOST_LIB_DIR = "${pkgs.boost}/lib";
shellHook = ''
echo "Bitcoin Core build nix-shell"
echo ""
BCC_EGG=${pkgs.linuxPackages.bcc}/lib/python3.11/site-packages/bcc-0.29.1-py3.11.egg
echo "adding bcc egg to PYTHONPATH: $BCC_EGG"
if [ -f $BCC_EGG ]; then
export PYTHONPATH="$PYTHONPATH:$BCC_EGG"
echo ""
else
echo "The bcc egg $BCC_EGG does not exist. Maybe the python or bcc version is different?"
fi
# autogen
alias a="sh autogen.sh"
# configure
alias c="./configure --with-boost-libdir=\$NIX_BOOST_LIB_DIR"
alias c_no-wallet="./configure --with-boost-libdir=\$NIX_BOOST_LIB_DIR --disable-wallet"
alias c_fast="./configure --with-boost-libdir=\$NIX_BOOST_LIB_DIR --disable-wallet --disable-tests --disable-fuzz --disable-bench -disable-fuzz-binary"
alias c_fast_wallet="./configure --with-boost-libdir=\$NIX_BOOST_LIB_DIR --disable-tests --disable-bench"
# make
alias m="make -j6"
# configure + make combos
alias cm="c && m"
alias cm_fast="c_fast && m"
# autogen + configure + make combos
alias acm="a && c && m"
alias acm_nw="a && c_no-wallet && m"
alias acm_fast="a && c_fast && m"
alias acm_fast_wallet="a && c_fast_wallet && m"
# tests
alias ut="make check"
# functional tests
alias ft="python3 test/functional/test_runner.py"
# all tests
alias t="ut && ft"
alias a c m c_fast cm acm acm_nw acm_fast ut ft t
'';
}
@dunxen
Copy link

dunxen commented May 6, 2023

Very nice! First result on kagi haha. Thanks :P

@0xB10C
Copy link
Author

0xB10C commented Mar 28, 2024

As discussed with @cbergqvist, moving this to https://github.com/0xB10C/nix-bitcoin-core for better collaboration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment