Merge #139: Convert nix-bitcoin extraConfig options to regular options

323b2a7f17 Allow adding multiple nodes to bitcoind with the addnodes option and improve bitcoin module option descriptions (Jonas Nick)
ed6511c96e Document how to override attributes in configuration.nix (Jonas Nick)
9d3588e1de Convert nix-bitcoin extraConfig options to regular options (Jonas Nick)

Pull request description:

Top commit has no ACKs.

Tree-SHA512: 02d7a38e41742f76979e2e12ae2195304a11a86c6547f5e1f3ff82b6031ad36b80d006a78cb4ec03fdfc4227ffdd60c5cc15bf898c32a3f213acaf2598da8eaf
This commit is contained in:
Jonas Nick 2020-02-26 21:35:15 +00:00
commit 56c69b5253
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
3 changed files with 50 additions and 8 deletions

View File

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }: { { config, pkgs, lib, ... }: {
imports = [ imports = [
./modules/nix-bitcoin.nix ./modules/nix-bitcoin.nix
@ -22,6 +22,17 @@
# you are doing. # you are doing.
services.nix-bitcoin.enable = true; services.nix-bitcoin.enable = true;
### BITCOIND
# Bitcoind is enabled by default if nix-bitcoin is enabled
#
# You can override default settings from nix-bitcoin.nix as follows
# services.bitcoind.prune = lib.mkForce 100000;
#
# You can add options that are not defined in modules/bitcoind.nix as follows
# services.bitcoind.extraConfig = ''
# maxorphantx=110
# '';
### CLIGHTNING ### CLIGHTNING
# Enable this module to use clightning, a Lightning Network implementation # Enable this module to use clightning, a Lightning Network implementation
# in C. # in C.

View File

@ -12,11 +12,16 @@ let
${optionalString (cfg.prune != null) "prune=${toString cfg.prune}"} ${optionalString (cfg.prune != null) "prune=${toString cfg.prune}"}
${optionalString (cfg.sysperms != null) "sysperms=${if cfg.sysperms then "1" else "0"}"} ${optionalString (cfg.sysperms != null) "sysperms=${if cfg.sysperms then "1" else "0"}"}
${optionalString (cfg.disablewallet != null) "disablewallet=${if cfg.disablewallet then "1" else "0"}"} ${optionalString (cfg.disablewallet != null) "disablewallet=${if cfg.disablewallet then "1" else "0"}"}
${optionalString (cfg.assumevalid != null) "assumevalid=${cfg.assumevalid}"}
# Connection options # Connection options
${optionalString (cfg.port != null) "port=${toString cfg.port}"} ${optionalString (cfg.port != null) "port=${toString cfg.port}"}
${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"} ${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"}
listen=${if cfg.listen then "1" else "0"} listen=${if cfg.listen then "1" else "0"}
${optionalString (cfg.discover != null) "discover=${if cfg.discover then "1" else "0"}"}
${lib.concatMapStrings (node: "addnode=${node}\n") cfg.addnodes}
# RPC server options # RPC server options
rpcport=${toString cfg.rpc.port} rpcport=${toString cfg.rpc.port}
@ -27,6 +32,9 @@ let
${optionalString (cfg.rpcuser != null) "rpcuser=${cfg.rpcuser}"} ${optionalString (cfg.rpcuser != null) "rpcuser=${cfg.rpcuser}"}
${optionalString (cfg.rpcpassword != null) "rpcpassword=${cfg.rpcpassword}"} ${optionalString (cfg.rpcpassword != null) "rpcpassword=${cfg.rpcpassword}"}
# Wallet options
${optionalString (cfg.addresstype != null) "addresstype=${cfg.addresstype}"}
# ZMQ options # ZMQ options
${optionalString (cfg.zmqpubrawblock != null) "zmqpubrawblock=${cfg.zmqpubrawblock}"} ${optionalString (cfg.zmqpubrawblock != null) "zmqpubrawblock=${cfg.zmqpubrawblock}"}
${optionalString (cfg.zmqpubrawtx != null) "zmqpubrawtx=${cfg.zmqpubrawtx}"} ${optionalString (cfg.zmqpubrawtx != null) "zmqpubrawtx=${cfg.zmqpubrawtx}"}
@ -209,6 +217,32 @@ in {
example = "tcp://127.0.0.1:28333"; example = "tcp://127.0.0.1:28333";
description = "ZMQ address for zmqpubrawtx notifications"; description = "ZMQ address for zmqpubrawtx notifications";
}; };
assumevalid = mkOption {
type = types.nullOr types.str;
default = null;
example = "00000000000000000000e5abc3a74fe27dc0ead9c70ea1deb456f11c15fd7bc6";
description = ''
If this block is in the chain assume that it and its ancestors are
valid and potentially skip their script verification.
'';
};
addnodes = mkOption {
type = types.listOf types.str;
default = [];
example = [ "ecoc5q34tmbq54wl.onion" ];
description = "Add nodes to connect to and attempt to keep the connections open";
};
discover = mkOption {
type = types.nullOr types.bool;
default = null;
description = "Discover own IP addresses";
};
addresstype = mkOption {
type = types.nullOr types.str;
default = null;
example = "bech32";
description = "What type of addresses to use";
};
cli = mkOption { cli = mkOption {
type = types.package; type = types.package;
readOnly = true; readOnly = true;

View File

@ -57,13 +57,10 @@ in {
services.bitcoind.rpcuser = "bitcoinrpc"; services.bitcoind.rpcuser = "bitcoinrpc";
services.bitcoind.zmqpubrawblock = "tcp://127.0.0.1:28332"; services.bitcoind.zmqpubrawblock = "tcp://127.0.0.1:28332";
services.bitcoind.zmqpubrawtx = "tcp://127.0.0.1:28333"; services.bitcoind.zmqpubrawtx = "tcp://127.0.0.1:28333";
services.bitcoind.extraConfig = '' services.bitcoind.assumevalid = "00000000000000000000e5abc3a74fe27dc0ead9c70ea1deb456f11c15fd7bc6";
assumevalid=00000000000000000000e5abc3a74fe27dc0ead9c70ea1deb456f11c15fd7bc6 services.bitcoind.addnodes = [ "ecoc5q34tmbq54wl.onion" ];
addnode=ecoc5q34tmbq54wl.onion services.bitcoind.discover = false;
discover=0 services.bitcoind.addresstype = "bech32";
addresstype=bech32
changetype=bech32
'';
services.bitcoind.prune = 0; services.bitcoind.prune = 0;
services.bitcoind.dbCache = 1000; services.bitcoind.dbCache = 1000;
services.tor.hiddenServices.bitcoind = { services.tor.hiddenServices.bitcoind = {