move systemPackages definitions to services
These are generally useful and shouldn't be limited to secure-node.nix. Also, only add the hardware-wallets group when hardware wallets are enabled.
This commit is contained in:
parent
6c22e13b7f
commit
37b2faf63c
|
@ -256,7 +256,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];
|
||||||
systemd.services.bitcoind = {
|
systemd.services.bitcoind = {
|
||||||
description = "Bitcoin daemon";
|
description = "Bitcoin daemon";
|
||||||
requires = [ "nix-bitcoin-secrets.target" ];
|
requires = [ "nix-bitcoin-secrets.target" ];
|
||||||
|
|
|
@ -71,6 +71,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ pkgs.nix-bitcoin.clightning (hiPrio cfg.cli) ];
|
||||||
users.users.clightning = {
|
users.users.clightning = {
|
||||||
description = "clightning User";
|
description = "clightning User";
|
||||||
group = "clightning";
|
group = "clightning";
|
||||||
|
|
|
@ -61,6 +61,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [{
|
config = mkIf cfg.enable (mkMerge [{
|
||||||
|
environment.systemPackages = [ pkgs.nix-bitcoin.electrs ];
|
||||||
|
|
||||||
systemd.services.electrs = {
|
systemd.services.electrs = {
|
||||||
description = "Electrs Electrum Server";
|
description = "Electrs Electrum Server";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
|
@ -32,11 +32,16 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
{
|
(mkIf (cfg.ledger || cfg.trezor) {
|
||||||
# Create group
|
environment.systemPackages = with pkgs; [
|
||||||
|
nix-bitcoin.hwi
|
||||||
|
# Provides lsusb for debugging
|
||||||
|
usbutils
|
||||||
|
];
|
||||||
users.groups."${cfg.group}" = {};
|
users.groups."${cfg.group}" = {};
|
||||||
}
|
})
|
||||||
(mkIf cfg.ledger {
|
(mkIf cfg.ledger {
|
||||||
|
|
||||||
# Ledger Nano S according to https://github.com/LedgerHQ/udev-rules/blob/master/add_udev_rules.sh
|
# Ledger Nano S according to https://github.com/LedgerHQ/udev-rules/blob/master/add_udev_rules.sh
|
||||||
# Don't use rules from nixpkgs because we want to use our own group.
|
# Don't use rules from nixpkgs because we want to use our own group.
|
||||||
services.udev.packages = lib.singleton (pkgs.writeTextFile {
|
services.udev.packages = lib.singleton (pkgs.writeTextFile {
|
||||||
|
@ -48,6 +53,7 @@ in {
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
(mkIf cfg.trezor {
|
(mkIf cfg.trezor {
|
||||||
|
environment.systemPackages = [ pkgs.python3.pkgs.trezor ];
|
||||||
# Don't use rules from nixpkgs because we want to use our own group.
|
# Don't use rules from nixpkgs because we want to use our own group.
|
||||||
services.udev.packages = lib.singleton (pkgs.writeTextFile {
|
services.udev.packages = lib.singleton (pkgs.writeTextFile {
|
||||||
name = "trezord-udev-rules";
|
name = "trezord-udev-rules";
|
||||||
|
|
|
@ -24,6 +24,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ pkgs.nix-bitcoin.lightning-charge ];
|
||||||
systemd.services.lightning-charge = {
|
systemd.services.lightning-charge = {
|
||||||
description = "Run lightning-charge";
|
description = "Run lightning-charge";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
|
@ -195,7 +195,11 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [ pkgs.nix-bitcoin.elementsd ];
|
environment.systemPackages = [
|
||||||
|
pkgs.nix-bitcoin.elementsd
|
||||||
|
(hiPrio cfg.cli)
|
||||||
|
(hiPrio cfg.swap-cli)
|
||||||
|
];
|
||||||
systemd.services.liquidd = {
|
systemd.services.liquidd = {
|
||||||
description = "Elements daemon providing access to the Liquid sidechain";
|
description = "Elements daemon providing access to the Liquid sidechain";
|
||||||
requires = [ "bitcoind.service" ];
|
requires = [ "bitcoind.service" ];
|
||||||
|
|
|
@ -77,7 +77,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];
|
||||||
systemd.services.lnd = {
|
systemd.services.lnd = {
|
||||||
description = "Run LND";
|
description = "Run LND";
|
||||||
path = [ pkgs.nix-bitcoin.bitcoind ];
|
path = [ pkgs.nix-bitcoin.bitcoind ];
|
||||||
|
|
|
@ -52,6 +52,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ pkgs.nix-bitcoin.nanopos ];
|
||||||
systemd.services.nanopos = {
|
systemd.services.nanopos = {
|
||||||
description = "Run nanopos";
|
description = "Run nanopos";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
@ -60,7 +61,6 @@ in {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
EnvironmentFile = "${config.nix-bitcoin.secretsDir}/nanopos-env";
|
EnvironmentFile = "${config.nix-bitcoin.secretsDir}/nanopos-env";
|
||||||
ExecStart = "${pkgs.nix-bitcoin.nanopos}/bin/nanopos -y ${cfg.itemsFile} -p ${toString cfg.port} --show-bolt11";
|
ExecStart = "${pkgs.nix-bitcoin.nanopos}/bin/nanopos -y ${cfg.itemsFile} -p ${toString cfg.port} --show-bolt11";
|
||||||
|
|
||||||
User = "nanopos";
|
User = "nanopos";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "10s";
|
RestartSec = "10s";
|
||||||
|
|
|
@ -108,30 +108,11 @@ in {
|
||||||
services.nix-bitcoin-webindex.enforceTor = true;
|
services.nix-bitcoin-webindex.enforceTor = true;
|
||||||
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; with nix-bitcoin;
|
environment.systemPackages = with pkgs; [
|
||||||
[
|
|
||||||
tor
|
tor
|
||||||
bitcoind
|
|
||||||
(hiPrio cfg.bitcoind.cli)
|
|
||||||
nodeinfo
|
|
||||||
jq
|
jq
|
||||||
qrencode
|
qrencode
|
||||||
]
|
nix-bitcoin.nodeinfo
|
||||||
++ optionals cfg.clightning.enable [clightning (hiPrio cfg.clightning.cli)]
|
|
||||||
++ optionals cfg.lnd.enable [lnd (hiPrio cfg.lnd.cli)]
|
|
||||||
++ optionals cfg.lightning-charge.enable [lightning-charge]
|
|
||||||
++ optionals cfg.nanopos.enable [nanopos]
|
|
||||||
++ optionals cfg.nix-bitcoin-webindex.enable [nginx]
|
|
||||||
++ optionals cfg.liquidd.enable [elementsd (hiPrio cfg.liquidd.cli) (hiPrio cfg.liquidd.swap-cli)]
|
|
||||||
++ optionals cfg.spark-wallet.enable [spark-wallet]
|
|
||||||
++ optionals cfg.electrs.enable [electrs]
|
|
||||||
++ optionals (cfg.hardware-wallets.ledger || cfg.hardware-wallets.trezor) [
|
|
||||||
hwi
|
|
||||||
# To allow debugging issues with lsusb
|
|
||||||
usbutils
|
|
||||||
]
|
|
||||||
++ optionals cfg.hardware-wallets.trezor [
|
|
||||||
python3.pkgs.trezor
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Create user operator which can use bitcoin-cli and lightning-cli
|
# Create user operator which can use bitcoin-cli and lightning-cli
|
||||||
|
|
|
@ -47,6 +47,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ pkgs.nix-bitcoin.spark-wallet ];
|
||||||
services.tor.enable = cfg.onion-service;
|
services.tor.enable = cfg.onion-service;
|
||||||
# requires client functionality for Bitcoin rate lookup
|
# requires client functionality for Bitcoin rate lookup
|
||||||
services.tor.client.enable = true;
|
services.tor.client.enable = true;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user