-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I build a custom bitcoin core branch? #668
Comments
It's not guaranteed that a bitcoind release derivation always works with a different source tree, so I don't think it makes sense to add a dedicated option for this. But Nix is flexible enough support this use case without much boilerplate:
Because bitcoind 26 can't be built with the bitcoind 25 derivation included in nix-bitcoin, we have to pull in the bitcoind 26 drv from a recent nixpkgs-unstable release: services.bitcoind.package = let
# nixpkgs-unstable as of 2023-12-27
# This is needed because nix-bitcoin's nixpkgs-unstable only includes bitcoind 25 which
# is incompatible with bitcoind 26.
pkgsUnstable = import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/5f64a12a728902226210bf01d25ec6cbb9d9265b.tar.gz";
sha256 = "0lq73nhcg11485ppazbnpz767qjifbydgqxn5xhj3xxlbfml39ba";
}) {};
in pkgsUnstable.bitcoind.overrideAttrs (old: {
version = "26-dev"; # Add version to the derivation name (optional)
src = builtins.fetchTarball {
url = "https://github.com/bitcoin/bitcoin/archive/4b1196a9855dcd188a24f393aa2fa21e2d61f061.tar.gz";
# If you change the above `url`, add an empty hash ("") to auto-fetch the hash during evaluation
sha256 = "18n5apgz4083r34hjwikgq8arycp8ysg1k2y7693b3b9b7qy8md4";
};
}); |
It's also possible to use a local build (outside of the nix store) for the service. |
@erikarvstedt thanks! I'll give that a try. |
It seems to be building... Is there a way to pass (update: looks like it already uses |
Mmm, it gets pretty far but then fails:
My branch starts from the same 4b1196a9855dcd188a24f393aa2fa21e2d61f061 master commit as yours and doesn't touch |
I'm also trying to add ccache to speed up future builds, but with the instructions here Here's the code that looks for it: https://github.com/bitcoin/bitcoin/blob/4b1196a9855dcd188a24f393aa2fa21e2d61f061/configure.ac#L1687-L1705 And above that there's a |
Ah, sorry, services.bitcoind.package = config.nix-bitcoin.pkgs.bitcoind.overrideAttrs (old: {
version = "26-dev";
src = builtins.fetchTarball {
url = "https://github.com/bitcoin/bitcoin/archive/4b1196a9855dcd188a24f393aa2fa21e2d61f061.tar.gz";
sha256 = "18n5apgz4083r34hjwikgq8arycp8ysg1k2y7693b3b9b7qy8md4";
};
postInstall = ''
installShellCompletion --bash contrib/completions/bash/bitcoin-cli.bash
installShellCompletion --bash contrib/completions/bash/bitcoind.bash
installShellCompletion --bash contrib/completions/bash/bitcoin-tx.bash
'';
}); CCacheHere's how to use
|
I'd like to be able to deploy non-release branches.
Something like
services.bitcoind.gitURL
,services.bitcoind.gitBranch
and (for safety)services.bitcoind.commit
or a sha256 hash of the source, would be handy.The text was updated successfully, but these errors were encountered: