Skip to content

Instantly share code, notes, and snippets.

@dergoegge
Last active October 27, 2022 13:36
Show Gist options
  • Save dergoegge/ec26571a24b3adce6574d757b81b6c27 to your computer and use it in GitHub Desktop.
Save dergoegge/ec26571a24b3adce6574d757b81b6c27 to your computer and use it in GitHub Desktop.
nix shell for bitcoin core
{ pkgs ? import <nixpkgs> {} }:
let
python-with-my-packages = pkgs.python38.withPackages (p: with p; [
setuptools
vulture
]);
in
(pkgs.mkShell.override { stdenv = pkgs.llvmPackages_14.stdenv; }) {
nativeBuildInputs = with pkgs; [
llvmPackages_14.libllvm
llvmPackages_14.bintools
lcov
autoconf
automake
libtool
pkg-config
boost
libevent
zeromq
sqlite
db48
# functional tests
python-with-my-packages
# debugging
gdb
valgrind
qt5.qtbase
];
# 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 ""
# 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-bench"
# make
alias m="make -j8"
# 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"
# 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
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment