Skip to content

Commit

Permalink
add module assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
nixbitcoin committed Jun 17, 2020
1 parent 23cd323 commit 980d4f8
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/electrs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
9 changes: 9 additions & 0 deletions modules/hardware-wallets.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ in {

config = mkMerge [
(mkIf (cfg.ledger || cfg.trezor) {
assertions = [
{ assertion = !config.services.bitcoind.dataDirReadableByGroup;
message = ''
Hardware-Wallets are not compatible with bitcoind.dataDirReadableByGroup.
Note that this option is active when enabling electrs.high-memory.
'';
}
];

environment.systemPackages = with pkgs; [
nix-bitcoin.hwi
# Provides lsusb for debugging
Expand Down
6 changes: 6 additions & 0 deletions modules/lightning-charge.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 6 additions & 0 deletions modules/lnd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
6 changes: 6 additions & 0 deletions modules/nanopos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 6 additions & 0 deletions modules/nix-bitcoin-webindex.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 - -"
];
Expand Down
6 changes: 6 additions & 0 deletions modules/recurring-donations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
6 changes: 6 additions & 0 deletions modules/spark-wallet.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 980d4f8

Please sign in to comment.