lightning-pool/loop: extract lnd variable
This commit is contained in:
parent
955b44404c
commit
be12a49933
@ -6,6 +6,9 @@ let
|
|||||||
cfg = config.services.lightning-loop;
|
cfg = config.services.lightning-loop;
|
||||||
nbLib = config.nix-bitcoin.lib;
|
nbLib = config.nix-bitcoin.lib;
|
||||||
secretsDir = config.nix-bitcoin.secretsDir;
|
secretsDir = config.nix-bitcoin.secretsDir;
|
||||||
|
|
||||||
|
lnd = config.services.lnd;
|
||||||
|
|
||||||
network = config.services.bitcoind.network;
|
network = config.services.bitcoind.network;
|
||||||
rpclisten = "${cfg.rpcAddress}:${toString cfg.rpcPort}";
|
rpclisten = "${cfg.rpcAddress}:${toString cfg.rpcPort}";
|
||||||
configFile = builtins.toFile "loop.conf" ''
|
configFile = builtins.toFile "loop.conf" ''
|
||||||
@ -17,8 +20,8 @@ let
|
|||||||
tlscertpath=${secretsDir}/loop-cert
|
tlscertpath=${secretsDir}/loop-cert
|
||||||
tlskeypath=${secretsDir}/loop-key
|
tlskeypath=${secretsDir}/loop-key
|
||||||
|
|
||||||
lnd.host=${config.services.lnd.rpcAddress}:${toString config.services.lnd.rpcPort}
|
lnd.host=${lnd.rpcAddress}:${toString lnd.rpcPort}
|
||||||
lnd.macaroonpath=${config.services.lnd.networkDir}/admin.macaroon
|
lnd.macaroonpath=${lnd.networkDir}/admin.macaroon
|
||||||
lnd.tlspath=${secretsDir}/lnd-cert
|
lnd.tlspath=${secretsDir}/lnd-cert
|
||||||
|
|
||||||
${optionalString (cfg.proxy != null) "server.proxy=${cfg.proxy}"}
|
${optionalString (cfg.proxy != null) "server.proxy=${cfg.proxy}"}
|
||||||
@ -89,7 +92,7 @@ in {
|
|||||||
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];
|
environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d '${cfg.dataDir}' 0770 ${config.services.lnd.user} ${config.services.lnd.group} - -"
|
"d '${cfg.dataDir}' 0770 ${lnd.user} ${lnd.group} - -"
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.lightning-loop = {
|
systemd.services.lightning-loop = {
|
||||||
@ -98,7 +101,7 @@ in {
|
|||||||
after = [ "lnd.service" ];
|
after = [ "lnd.service" ];
|
||||||
serviceConfig = nbLib.defaultHardening // {
|
serviceConfig = nbLib.defaultHardening // {
|
||||||
ExecStart = "${cfg.package}/bin/loopd --configfile=${configFile}";
|
ExecStart = "${cfg.package}/bin/loopd --configfile=${configFile}";
|
||||||
User = config.services.lnd.user;
|
User = lnd.user;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "10s";
|
RestartSec = "10s";
|
||||||
ReadWritePaths = cfg.dataDir;
|
ReadWritePaths = cfg.dataDir;
|
||||||
@ -106,8 +109,8 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
nix-bitcoin.secrets = {
|
nix-bitcoin.secrets = {
|
||||||
loop-key.user = config.services.lnd.user;
|
loop-key.user = lnd.user;
|
||||||
loop-cert.user = config.services.lnd.user;
|
loop-cert.user = lnd.user;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,9 @@ let
|
|||||||
cfg = config.services.lightning-pool;
|
cfg = config.services.lightning-pool;
|
||||||
nbLib = config.nix-bitcoin.lib;
|
nbLib = config.nix-bitcoin.lib;
|
||||||
secretsDir = config.nix-bitcoin.secretsDir;
|
secretsDir = config.nix-bitcoin.secretsDir;
|
||||||
|
|
||||||
|
lnd = config.services.lnd;
|
||||||
|
|
||||||
network = config.services.bitcoind.network;
|
network = config.services.bitcoind.network;
|
||||||
rpclisten = "${cfg.rpcAddress}:${toString cfg.rpcPort}";
|
rpclisten = "${cfg.rpcAddress}:${toString cfg.rpcPort}";
|
||||||
configFile = builtins.toFile "pool.conf" ''
|
configFile = builtins.toFile "pool.conf" ''
|
||||||
@ -13,8 +16,8 @@ let
|
|||||||
restlisten=${cfg.restAddress}:${toString cfg.restPort}
|
restlisten=${cfg.restAddress}:${toString cfg.restPort}
|
||||||
${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"}
|
${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"}
|
||||||
|
|
||||||
lnd.host=${config.services.lnd.rpcAddress}:${toString config.services.lnd.rpcPort}
|
lnd.host=${lnd.rpcAddress}:${toString lnd.rpcPort}
|
||||||
lnd.macaroondir=${config.services.lnd.networkDir}
|
lnd.macaroondir=${lnd.networkDir}
|
||||||
lnd.tlspath=${secretsDir}/lnd-cert
|
lnd.tlspath=${secretsDir}/lnd-cert
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
|
Loading…
Reference in New Issue
Block a user