services: auto-enable dependencies

This commit is contained in:
Erik Arvstedt 2020-10-18 14:49:20 +02:00
parent 06cba7b519
commit 67e49fe415
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
12 changed files with 28 additions and 37 deletions

View File

@ -65,7 +65,7 @@
### SPARK WALLET ### SPARK WALLET
# Enable this module to use spark-wallet, a minimalistic wallet GUI for # Enable this module to use spark-wallet, a minimalistic wallet GUI for
# c-lightning, accessible over the web or through mobile and desktop apps. # c-lightning, accessible over the web or through mobile and desktop apps.
# Only available if clightning is enabled. # Automatically enables clightning.
# services.spark-wallet.enable = true; # services.spark-wallet.enable = true;
### ELECTRS ### ELECTRS
@ -87,6 +87,7 @@
# services.btcpayserver.lightningBackend = "clightning"; # services.btcpayserver.lightningBackend = "clightning";
# Enable this option to connect BTCPayServert to lnd. # Enable this option to connect BTCPayServert to lnd.
# services.btcpayserver.lightningBackend = "lnd"; # services.btcpayserver.lightningBackend = "lnd";
# The lightning backend service automatically enabled.
# Afterwards you need to go into Store > General Settings > Lightning Nodes # Afterwards you need to go into Store > General Settings > Lightning Nodes
# and click to use "the internal lightning node of this BTCPay Server". # and click to use "the internal lightning node of this BTCPay Server".
@ -99,13 +100,14 @@
### LIGHTNING CHARGE ### LIGHTNING CHARGE
# Enable this module to use lightning-charge, a simple drop-in solution for # Enable this module to use lightning-charge, a simple drop-in solution for
# accepting lightning payments. Only available if clightning is enabled. # accepting lightning payments.
# Automatically enables clightning.
# services.lightning-charge.enable = true; # services.lightning-charge.enable = true;
### NANOPOS ### NANOPOS
# Enable this module to use nanopos, a simple Lightning point-of-sale # Enable this module to use nanopos, a simple Lightning point-of-sale
# system, powered by Lightning Charge. Only available if clightning and # system, powered by Lightning Charge.
# lightning-charge are enabled. # Automatically enables lightning-charge.
# services.nanopos.enable = true; # services.nanopos.enable = true;
### WEBINDEX ### WEBINDEX
@ -117,7 +119,8 @@
### RECURRING-DONATIONS ### RECURRING-DONATIONS
# Enable this module to send recurring donations. This is EXPERIMENTAL; it's # Enable this module to send recurring donations. This is EXPERIMENTAL; it's
# not guaranteed that payments are succeeding or that you will notice payment # not guaranteed that payments are succeeding or that you will notice payment
# failure. Only available if clightning is enabled. # failure.
# Automatically enables clightning.
# services.recurring-donations.enable = true; # services.recurring-donations.enable = true;
# Specify the receivers of the donations. By default donations are every # Specify the receivers of the donations. By default donations are every
# Monday at a randomized time. Check `journalctl -eu recurring-donations` or # Monday at a randomized time. Check `journalctl -eu recurring-donations` or
@ -149,6 +152,7 @@
# Enable this module to use lightninglab's non-custodial off/on chain bridge. # Enable this module to use lightninglab's non-custodial off/on chain bridge.
# loopd (lightning-loop daemon) will be started automatically. Users can # loopd (lightning-loop daemon) will be started automatically. Users can
# interact with off/on chain bridge using `loop in` and `loop out`. # interact with off/on chain bridge using `loop in` and `loop out`.
# Automatically enables lnd.
# services.lightning-loop.enable = true; # services.lightning-loop.enable = true;
### Backups ### Backups

View File

@ -90,13 +90,9 @@ in {
}; };
config = mkIf cfg.btcpayserver.enable { config = mkIf cfg.btcpayserver.enable {
assertions = let services.bitcoind.enable = true;
backend = cfg.btcpayserver.lightningBackend; services.clightning.enable = mkIf (cfg.btcpayserver.lightningBackend == "clightning") true;
in [ services.lnd.enable = mkIf (cfg.btcpayserver.lightningBackend == "lnd") true;
{ assertion = (backend != null) -> cfg.${backend}.enable;
message = "btcpayserver requires ${backend}.";
}
];
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d '${cfg.nbxplorer.dataDir}' 0770 ${cfg.nbxplorer.user} ${cfg.nbxplorer.group} - -" "d '${cfg.nbxplorer.dataDir}' 0770 ${cfg.nbxplorer.user} ${cfg.nbxplorer.group} - -"

View File

@ -100,6 +100,8 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.bitcoind.enable = true;
environment.systemPackages = [ pkgs.nix-bitcoin.clightning (hiPrio cfg.cli) ]; environment.systemPackages = [ pkgs.nix-bitcoin.clightning (hiPrio cfg.cli) ];
users.users.${cfg.user} = { users.users.${cfg.user} = {
description = "clightning User"; description = "clightning User";

View File

@ -61,6 +61,8 @@ in {
} }
]; ];
services.bitcoind.enable = true;
environment.systemPackages = [ pkgs.nix-bitcoin.electrs ]; environment.systemPackages = [ pkgs.nix-bitcoin.electrs ];
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [

View File

@ -117,6 +117,8 @@ in {
}; };
config = mkIf cfg.enable (mkMerge [{ config = mkIf cfg.enable (mkMerge [{
services.bitcoind.enable = true;
environment.systemPackages = [ environment.systemPackages = [
(hiPrio cfg.cli) (hiPrio cfg.cli)
]; ];

View File

@ -38,11 +38,7 @@ in {
warnings = ['' warnings = [''
The lightning-charge module is deprecated and will be removed soon. The lightning-charge module is deprecated and will be removed soon.
'']; ''];
assertions = [ services.clightning.enable = true;
{ assertion = config.services.clightning.enable;
message = "lightning-charge requires clightning.";
}
];
users.users.lightning-charge = { users.users.lightning-charge = {
description = "lightning-charge User"; description = "lightning-charge User";

View File

@ -59,11 +59,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ services.lnd.enable = true;
{ assertion = config.services.lnd.enable;
message = "lightning-loop requires lnd.";
}
];
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ]; environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];

View File

@ -221,6 +221,8 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.bitcoind.enable = true;
environment.systemPackages = [ environment.systemPackages = [
pkgs.nix-bitcoin.elementsd pkgs.nix-bitcoin.elementsd
(hiPrio cfg.cli) (hiPrio cfg.cli)

View File

@ -154,6 +154,8 @@ in {
} }
]; ];
services.bitcoind.enable = true;
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ]; environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [

View File

@ -76,11 +76,8 @@ in {
The nanopos module is deprecated and will be removed soon. You can use the The nanopos module is deprecated and will be removed soon. You can use the
btcpayserver module instead. btcpayserver module instead.
'']; ''];
assertions = [
{ assertion = config.services.lightning-charge.enable; services.lightning-charge.enable = true;
message = "nanopos requires lightning-charge.";
}
];
environment.systemPackages = [ pkgs.nix-bitcoin.nanopos ]; environment.systemPackages = [ pkgs.nix-bitcoin.nanopos ];

View File

@ -79,11 +79,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ services.clightning.enable = true;
{ assertion = config.services.clightning.enable;
message = "recurring-donations requires clightning.";
}
];
users.users.recurring-donations = { users.users.recurring-donations = {
description = "recurring-donations User"; description = "recurring-donations User";

View File

@ -52,11 +52,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ services.clightning.enable = true;
{ assertion = config.services.clightning.enable;
message = "spark-wallet requires clightning.";
}
];
environment.systemPackages = [ pkgs.nix-bitcoin.spark-wallet ]; environment.systemPackages = [ pkgs.nix-bitcoin.spark-wallet ];
users.users.spark-wallet = { users.users.spark-wallet = {