Merge #189: Update configuration.nix

f280d54bb8 add module assertions (nixbitcoin)
23cd323ad1 assertions: add lnd, clightning exclusivity (nixbitcoin)
0ad524ca2d example config: clarify nix-bitcoin will auto-detect invalid settings (nixbitcoin)
c16924b850 example config: change hwi excluding dependency to high-memory (nixbitcoin)
0fd99c4cc0 bitcoind: simplify pruning (nixbitcoin)
b9a7a71873 example config: document enabling pruning (nixbitcoin)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK f280d54bb8

Tree-SHA512: a900dc2b95cdc01b457c65853930cb1c31b5288fab06d665207ffb2bcd1d54d75add73113ccaacd98e882d4e6674eb8393fec1ae0a01688de1b56250d5d3d3d6
This commit is contained in:
Jonas Nick 2020-06-17 09:27:37 +00:00
commit a03597ae8e
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
12 changed files with 78 additions and 21 deletions

View File

@ -23,8 +23,11 @@
### BITCOIND
# Bitcoind is enabled by default if nix-bitcoin is enabled
#
# You can override default settings from secure-node.nix as follows
# services.bitcoind.prune = lib.mkForce 100000;
# Enable this option to set pruning to a specified MiB value.
# clightning is compatible with pruning. See
# https://github.com/ElementsProject/lightning/#pruning for more information.
# LND and electrs are not compatible with pruning.
# services.bitcoind.prune = 100000;
#
# You can add options that are not defined in modules/bitcoind.nix as follows
# services.bitcoind.extraConfig = ''
@ -42,7 +45,7 @@
### LND
# Disable clightning and uncomment the following line in order to enable lnd,
# a lightning implementation written in Go.
# services.lnd.enable = assert (!config.services.clightning.enable); true;
# services.lnd.enable = true;
## WARNING
# If you use lnd, you should manually backup your wallet mnemonic
# seed. This will allow you to recover on-chain funds. You can run the
@ -55,16 +58,15 @@
### SPARK WALLET
# Enable this module to use spark-wallet, a minimalistic wallet GUI for
# c-lightning, accessible over the web or through mobile and desktop apps.
# Only enable this if clightning is enabled.
# Only available if clightning is enabled.
# services.spark-wallet.enable = true;
### ELECTRS
# Enable this module to use electrs, an efficient re-implementation of
# Electrum Server in Rust. Only enable this if hardware wallets are
# disabled.
# Electrum Server in Rust.
# services.electrs.enable = true;
# If you have more than 8GB memory, enable this option so electrs will
# sync faster.
# sync faster. Only available if hardware wallets are disabled.
# services.electrs.high-memory = true;
### LIQUIDD
@ -76,25 +78,25 @@
### LIGHTNING CHARGE
# Enable this module to use lightning-charge, a simple drop-in solution for
# accepting lightning payments. Only enable this if clightning is enabled.
# accepting lightning payments. Only available if clightning is enabled.
# services.lightning-charge.enable = true;
### NANOPOS
# Enable this module to use nanopos, a simple Lightning point-of-sale
# system, powered by Lightning Charge. Only enable this if clightning and
# system, powered by Lightning Charge. Only available if clightning and
# lightning-charge are enabled.
# services.nanopos.enable = true;
### WEBINDEX
# Enable this module to use the nix-bitcoin-webindex, a simple website
# displaying your node information and link to nanopos store. Only enable
# this if clightning, lightning-charge, and nanopos are enabled.
# displaying your node information and link to nanopos store. Only available
# if clightning, lightning-charge, and nanopos are enabled.
# services.nix-bitcoin-webindex.enable = true;
### RECURRING-DONATIONS
# Enable this module to send recurring donations. This is EXPERIMENTAL; it's
# not guaranteed that payments are succeeding or that you will notice payment
# failure. Only enable this if clightning is enabled.
# failure. Only available if clightning is enabled.
# services.recurring-donations.enable = true;
# Specify the receivers of the donations. By default donations are every
# Monday at a randomized time. Check `journalctl -eu recurring-donations` or
@ -107,7 +109,7 @@
### Hardware wallets
# Enable this module to allow using hardware wallets. See https://github.com/bitcoin-core/HWI
# for more information. Only enable this if electrs is disabled.
# for more information. Only available if electrs.high-memory is disabled.
# Ledger must be initialized through the official ledger live app and the Bitcoin app must
# be installed and running on the device.
# services.hardware-wallets.ledger = true;

View File

@ -12,7 +12,7 @@ let
${optionalString cfg.testnet "testnet=1"}
${optionalString (cfg.dbCache != null) "dbcache=${toString cfg.dbCache}"}
${optionalString (cfg.prune != null) "prune=${toString cfg.prune}"}
"prune=${toString cfg.prune}
${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.assumevalid != null) "assumevalid=${cfg.assumevalid}"}
@ -179,12 +179,8 @@ in {
description = "Override the default database cache size in megabytes.";
};
prune = mkOption {
type = types.nullOr (types.coercedTo
(types.enum [ "disable" "manual" ])
(x: if x == "disable" then 0 else 1)
types.ints.unsigned
);
default = null;
type = types.ints.unsigned;
default = 0;
example = 10000;
description = ''
Reduce storage requirements by enabling pruning (deleting) of old

View File

@ -61,6 +61,12 @@ in {
};
config = mkIf cfg.enable (mkMerge [{
assertions = [
{ assertion = config.services.bitcoind.prune == 0;
message = "electrs does not support bitcoind pruning.";
}
];
environment.systemPackages = [ pkgs.nix-bitcoin.electrs ];
systemd.tmpfiles.rules = [

View File

@ -33,6 +33,15 @@ in {
config = mkMerge [
(mkIf (cfg.ledger || cfg.trezor) {
assertions = [
{ assertion = (config.services.bitcoind.disablewallet == null || !config.services.bitcoind.disablewallet);
message = ''
Hardware-Wallets are not compatible with bitcoind.disablewallet.
Note that this option is active when enabling electrs.high-memory.
'';
}
];
environment.systemPackages = with pkgs; [
nix-bitcoin.hwi
# Provides lsusb for debugging

View File

@ -24,6 +24,12 @@ in {
};
config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.clightning.enable;
message = "lightning-charge requires clightning.";
}
];
users.users.lightning-charge = {
description = "lightning-charge User";
group = "lightning-charge";

View File

@ -83,6 +83,12 @@ in {
};
config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.bitcoind.prune == 0;
message = "lnd does not support bitcoind pruning.";
}
];
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];
systemd.tmpfiles.rules = [

View File

@ -26,6 +26,15 @@
};
config = {
assertions = [
# lnd.wantedBy == [] needed for `test/tests.nix` in which both clightning and lnd are enabled
{ assertion = config.services.lnd.enable -> (!config.services.clightning.enable || config.systemd.services.lnd.wantedBy == []);
message = ''
LND and clightning can't be run in parallel because they both bind to lightning port 9735.
'';
}
];
nixpkgs.overlays = [ (self: super: {
nix-bitcoin = let
pkgs = import ../pkgs { pkgs = super; };

View File

@ -52,6 +52,12 @@ in {
};
config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.lightning-charge.enable;
message = "nanopos requires lightning-charge.";
}
];
environment.systemPackages = [ pkgs.nix-bitcoin.nanopos ];
systemd.services.nanopos = {
description = "Run nanopos";

View File

@ -47,6 +47,12 @@ in {
};
config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.nanopos.enable;
message = "nix-bitcoin-webindex requires nanopos.";
}
];
systemd.tmpfiles.rules = [
"d /var/www 0755 nginx nginx - -"
];

View File

@ -64,7 +64,6 @@ in {
addnodes = [ "ecoc5q34tmbq54wl.onion" ];
discover = false;
addresstype = "bech32";
prune = 0;
dbCache = 1000;
};
services.tor.hiddenServices.bitcoind = mkHiddenService { port = cfg.bitcoind.port; };

View File

@ -78,6 +78,12 @@ in {
};
config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.clightning.enable;
message = "recurring-donations requires clightning.";
}
];
users.users.recurring-donations = {
description = "recurring-donations User";
group = "recurring-donations";

View File

@ -46,6 +46,12 @@ in {
};
config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.clightning.enable;
message = "spark-wallet requires clightning.";
}
];
environment.systemPackages = [ pkgs.nix-bitcoin.spark-wallet ];
users.users.spark-wallet = {
description = "spark-wallet User";