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:
Erik Arvstedt 2020-04-07 22:47:45 +02:00
parent 6c22e13b7f
commit 37b2faf63c
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
10 changed files with 24 additions and 28 deletions

View File

@ -256,7 +256,7 @@ in {
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];
systemd.services.bitcoind = {
description = "Bitcoin daemon";
requires = [ "nix-bitcoin-secrets.target" ];

View File

@ -71,6 +71,7 @@ in {
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.nix-bitcoin.clightning (hiPrio cfg.cli) ];
users.users.clightning = {
description = "clightning User";
group = "clightning";

View File

@ -61,6 +61,8 @@ in {
};
config = mkIf cfg.enable (mkMerge [{
environment.systemPackages = [ pkgs.nix-bitcoin.electrs ];
systemd.services.electrs = {
description = "Electrs Electrum Server";
wantedBy = [ "multi-user.target" ];

View File

@ -32,11 +32,16 @@ in {
};
config = mkMerge [
{
# Create group
(mkIf (cfg.ledger || cfg.trezor) {
environment.systemPackages = with pkgs; [
nix-bitcoin.hwi
# Provides lsusb for debugging
usbutils
];
users.groups."${cfg.group}" = {};
}
})
(mkIf cfg.ledger {
# 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.
services.udev.packages = lib.singleton (pkgs.writeTextFile {
@ -48,6 +53,7 @@ in {
});
})
(mkIf cfg.trezor {
environment.systemPackages = [ pkgs.python3.pkgs.trezor ];
# Don't use rules from nixpkgs because we want to use our own group.
services.udev.packages = lib.singleton (pkgs.writeTextFile {
name = "trezord-udev-rules";

View File

@ -24,6 +24,7 @@ in {
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.nix-bitcoin.lightning-charge ];
systemd.services.lightning-charge = {
description = "Run lightning-charge";
wantedBy = [ "multi-user.target" ];

View File

@ -195,7 +195,11 @@ in {
};
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 = {
description = "Elements daemon providing access to the Liquid sidechain";
requires = [ "bitcoind.service" ];

View File

@ -77,7 +77,7 @@ in {
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];
systemd.services.lnd = {
description = "Run LND";
path = [ pkgs.nix-bitcoin.bitcoind ];

View File

@ -52,6 +52,7 @@ in {
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.nix-bitcoin.nanopos ];
systemd.services.nanopos = {
description = "Run nanopos";
wantedBy = [ "multi-user.target" ];
@ -60,7 +61,6 @@ in {
serviceConfig = {
EnvironmentFile = "${config.nix-bitcoin.secretsDir}/nanopos-env";
ExecStart = "${pkgs.nix-bitcoin.nanopos}/bin/nanopos -y ${cfg.itemsFile} -p ${toString cfg.port} --show-bolt11";
User = "nanopos";
Restart = "on-failure";
RestartSec = "10s";

View File

@ -108,30 +108,11 @@ in {
services.nix-bitcoin-webindex.enforceTor = true;
environment.systemPackages = with pkgs; with nix-bitcoin;
[
environment.systemPackages = with pkgs; [
tor
bitcoind
(hiPrio cfg.bitcoind.cli)
nodeinfo
jq
qrencode
]
++ 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
nix-bitcoin.nodeinfo
];
# Create user operator which can use bitcoin-cli and lightning-cli

View File

@ -47,6 +47,7 @@ in {
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.nix-bitcoin.spark-wallet ];
services.tor.enable = cfg.onion-service;
# requires client functionality for Bitcoin rate lookup
services.tor.client.enable = true;