Skip to content
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

Services: Auto-enable dependencies #251

Merged
merged 1 commit into from
Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions examples/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
### 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 available if clightning is enabled.
# Automatically enables clightning.
# services.spark-wallet.enable = true;

### ELECTRS
Expand All @@ -87,6 +87,7 @@
# services.btcpayserver.lightningBackend = "clightning";
# Enable this option to connect BTCPayServert to lnd.
# services.btcpayserver.lightningBackend = "lnd";
# The lightning backend service automatically enabled.
# Afterwards you need to go into Store > General Settings > Lightning Nodes
# and click to use "the internal lightning node of this BTCPay Server".

Expand All @@ -99,13 +100,14 @@

### LIGHTNING CHARGE
# 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;

### NANOPOS
# Enable this module to use nanopos, a simple Lightning point-of-sale
# system, powered by Lightning Charge. Only available if clightning and
# lightning-charge are enabled.
# system, powered by Lightning Charge.
# Automatically enables lightning-charge.
# services.nanopos.enable = true;

### WEBINDEX
Expand All @@ -117,7 +119,8 @@
### 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 available if clightning is enabled.
# failure.
# Automatically enables clightning.
# 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
Expand Down Expand Up @@ -149,6 +152,7 @@
# Enable this module to use lightninglab's non-custodial off/on chain bridge.
# loopd (lightning-loop daemon) will be started automatically. Users can
# interact with off/on chain bridge using `loop in` and `loop out`.
# Automatically enables lnd.
# services.lightning-loop.enable = true;

### Backups
Expand Down
10 changes: 3 additions & 7 deletions modules/btcpayserver.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,9 @@ in {
};

config = mkIf cfg.btcpayserver.enable {
assertions = let
backend = cfg.btcpayserver.lightningBackend;
in [
{ assertion = (backend != null) -> cfg.${backend}.enable;
message = "btcpayserver requires ${backend}.";
}
];
services.bitcoind.enable = true;
services.clightning.enable = mkIf (cfg.btcpayserver.lightningBackend == "clightning") true;
services.lnd.enable = mkIf (cfg.btcpayserver.lightningBackend == "lnd") true;

systemd.tmpfiles.rules = [
"d '${cfg.nbxplorer.dataDir}' 0770 ${cfg.nbxplorer.user} ${cfg.nbxplorer.group} - -"
Expand Down
2 changes: 2 additions & 0 deletions modules/clightning.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ in {
};

config = mkIf cfg.enable {
services.bitcoind.enable = true;

environment.systemPackages = [ pkgs.nix-bitcoin.clightning (hiPrio cfg.cli) ];
users.users.${cfg.user} = {
description = "clightning User";
Expand Down
2 changes: 2 additions & 0 deletions modules/electrs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ in {
}
];

services.bitcoind.enable = true;

environment.systemPackages = [ pkgs.nix-bitcoin.electrs ];

systemd.tmpfiles.rules = [
Expand Down
2 changes: 2 additions & 0 deletions modules/joinmarket.nix
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ in {
};

config = mkIf cfg.enable (mkMerge [{
services.bitcoind.enable = true;

environment.systemPackages = [
(hiPrio cfg.cli)
];
Expand Down
6 changes: 1 addition & 5 deletions modules/lightning-charge.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ in {
warnings = [''
The lightning-charge module is deprecated and will be removed soon.
''];
assertions = [
{ assertion = config.services.clightning.enable;
message = "lightning-charge requires clightning.";
}
];
services.clightning.enable = true;

users.users.lightning-charge = {
description = "lightning-charge User";
Expand Down
6 changes: 1 addition & 5 deletions modules/lightning-loop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ in {
};

config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.lnd.enable;
message = "lightning-loop requires lnd.";
}
];
services.lnd.enable = true;

environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];

Expand Down
2 changes: 2 additions & 0 deletions modules/liquid.nix
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ in {
};

config = mkIf cfg.enable {
services.bitcoind.enable = true;

environment.systemPackages = [
pkgs.nix-bitcoin.elementsd
(hiPrio cfg.cli)
Expand Down
2 changes: 2 additions & 0 deletions modules/lnd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ in {
}
];

services.bitcoind.enable = true;

environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];

systemd.tmpfiles.rules = [
Expand Down
7 changes: 2 additions & 5 deletions modules/nanopos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,8 @@ in {
The nanopos module is deprecated and will be removed soon. You can use the
btcpayserver module instead.
''];
assertions = [
{ assertion = config.services.lightning-charge.enable;
message = "nanopos requires lightning-charge.";
}
];

services.lightning-charge.enable = true;

environment.systemPackages = [ pkgs.nix-bitcoin.nanopos ];

Expand Down
6 changes: 1 addition & 5 deletions modules/recurring-donations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ in {
};

config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.clightning.enable;
message = "recurring-donations requires clightning.";
}
];
services.clightning.enable = true;

users.users.recurring-donations = {
description = "recurring-donations User";
Expand Down
6 changes: 1 addition & 5 deletions modules/spark-wallet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ in {
};

config = mkIf cfg.enable {
assertions = [
{ assertion = config.services.clightning.enable;
message = "spark-wallet requires clightning.";
}
];
services.clightning.enable = true;

environment.systemPackages = [ pkgs.nix-bitcoin.spark-wallet ];
users.users.spark-wallet = {
Expand Down