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
12 changed files with 78 additions and 21 deletions

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";