rtl: use clnrest
Using `clightning-rest` is no longer supported by rtl.
This commit is contained in:
parent
4e9c153f9c
commit
ad2a128471
3 changed files with 21 additions and 16 deletions
|
|
@ -17,8 +17,6 @@ c systemctl status rtl
|
||||||
c journalctl -u rtl
|
c journalctl -u rtl
|
||||||
c cat /var/lib/rtl/RTL-Config.json
|
c cat /var/lib/rtl/RTL-Config.json
|
||||||
|
|
||||||
c systemctl status clightning-rest
|
|
||||||
|
|
||||||
# Open webinterface. Password: a
|
# Open webinterface. Password: a
|
||||||
runuser -u "$(logname)" -- xdg-open "http://$ip:3000"
|
runuser -u "$(logname)" -- xdg-open "http://$ip:3000"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,7 @@ in {
|
||||||
in
|
in
|
||||||
optional nodes.lnd.enable "lnd" ++
|
optional nodes.lnd.enable "lnd" ++
|
||||||
optional (nodes.lnd.enable && nodes.lnd.loop) "lightning-loop" ++
|
optional (nodes.lnd.enable && nodes.lnd.loop) "lightning-loop" ++
|
||||||
optional nodes.clightning.enable "clightning-rest";
|
optional nodes.clightning.enable "clightning";
|
||||||
};
|
};
|
||||||
clightning-rest = {
|
clightning-rest = {
|
||||||
id = 30;
|
id = 30;
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ let
|
||||||
nbLib = config.nix-bitcoin.lib;
|
nbLib = config.nix-bitcoin.lib;
|
||||||
nbPkgs = config.nix-bitcoin.pkgs;
|
nbPkgs = config.nix-bitcoin.pkgs;
|
||||||
secretsDir = config.nix-bitcoin.secretsDir;
|
secretsDir = config.nix-bitcoin.secretsDir;
|
||||||
|
runePath = "${cfg.dataDir}/clightning-admin-rune";
|
||||||
|
|
||||||
inherit (nbLib) optionalAttr;
|
inherit (nbLib) optionalAttr;
|
||||||
|
|
||||||
|
|
@ -116,9 +117,8 @@ let
|
||||||
lnImplementation = if isLnd then "LND" else "CLT";
|
lnImplementation = if isLnd then "LND" else "CLT";
|
||||||
Authentication = {
|
Authentication = {
|
||||||
${optionalAttr (isLnd && lndLoopEnabled) "swapMacaroonPath"} = "${lightning-loop.dataDir}/${bitcoind.network}";
|
${optionalAttr (isLnd && lndLoopEnabled) "swapMacaroonPath"} = "${lightning-loop.dataDir}/${bitcoind.network}";
|
||||||
macaroonPath = if isLnd
|
${optionalAttr (isLnd) "macaroonPath"} = "${cfg.dataDir}/macaroons";
|
||||||
then "${cfg.dataDir}/macaroons"
|
${optionalAttr (!isLnd) "runePath"} = runePath;
|
||||||
else "${clightning-rest.dataDir}/certs";
|
|
||||||
};
|
};
|
||||||
Settings = {
|
Settings = {
|
||||||
userPersona = "OPERATOR";
|
userPersona = "OPERATOR";
|
||||||
|
|
@ -133,7 +133,7 @@ let
|
||||||
lnServerUrl = "https://${
|
lnServerUrl = "https://${
|
||||||
if isLnd
|
if isLnd
|
||||||
then nbLib.addressWithPort lnd.restAddress lnd.restPort
|
then nbLib.addressWithPort lnd.restAddress lnd.restPort
|
||||||
else nbLib.addressWithPort clightning-rest.address clightning-rest.port
|
else nbLib.addressWithPort clightning.plugins.clnrest.address clightning.plugins.clnrest.port
|
||||||
}";
|
}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -159,7 +159,7 @@ let
|
||||||
inherit (config.services)
|
inherit (config.services)
|
||||||
bitcoind
|
bitcoind
|
||||||
lnd
|
lnd
|
||||||
clightning-rest
|
clightning
|
||||||
lightning-loop;
|
lightning-loop;
|
||||||
|
|
||||||
lndLoopEnabled = cfg.nodes.lnd.enable && cfg.nodes.lnd.loop;
|
lndLoopEnabled = cfg.nodes.lnd.enable && cfg.nodes.lnd.loop;
|
||||||
|
|
@ -177,7 +177,10 @@ in {
|
||||||
|
|
||||||
services.lnd.enable = mkIf cfg.nodes.lnd.enable true;
|
services.lnd.enable = mkIf cfg.nodes.lnd.enable true;
|
||||||
services.lightning-loop.enable = mkIf lndLoopEnabled true;
|
services.lightning-loop.enable = mkIf lndLoopEnabled true;
|
||||||
services.clightning-rest.enable = mkIf cfg.nodes.clightning.enable true;
|
services.clightning = mkIf cfg.nodes.clightning.enable {
|
||||||
|
enable = true;
|
||||||
|
plugins.clnrest.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d '${cfg.dataDir}' 0770 ${cfg.user} ${cfg.group} - -"
|
"d '${cfg.dataDir}' 0770 ${cfg.user} ${cfg.group} - -"
|
||||||
|
|
@ -187,7 +190,7 @@ in {
|
||||||
|
|
||||||
systemd.services.rtl = rec {
|
systemd.services.rtl = rec {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
requires = optional cfg.nodes.clightning.enable "clightning-rest.service" ++
|
requires = optional cfg.nodes.clightning.enable "clightning.service" ++
|
||||||
optional cfg.nodes.lnd.enable "lnd.service";
|
optional cfg.nodes.lnd.enable "lnd.service";
|
||||||
after = requires ++ [ "nix-bitcoin-secrets.target" ];
|
after = requires ++ [ "nix-bitcoin-secrets.target" ];
|
||||||
environment.RTL_CONFIG_PATH = cfg.dataDir;
|
environment.RTL_CONFIG_PATH = cfg.dataDir;
|
||||||
|
|
@ -198,10 +201,17 @@ in {
|
||||||
<${configFile} sed "s|@multiPass@|$(cat ${secretsDir}/rtl-password)|" \
|
<${configFile} sed "s|@multiPass@|$(cat ${secretsDir}/rtl-password)|" \
|
||||||
> '${cfg.dataDir}/RTL-Config.json'
|
> '${cfg.dataDir}/RTL-Config.json'
|
||||||
'')
|
'')
|
||||||
] ++ optional cfg.nodes.lnd.enable
|
]
|
||||||
|
++ optional cfg.nodes.lnd.enable
|
||||||
|
# The lnd admin macaroon is not readable by group `lnd`, so copy it
|
||||||
(nbLib.rootScript "rtl-copy-macaroon" ''
|
(nbLib.rootScript "rtl-copy-macaroon" ''
|
||||||
install -D -o ${cfg.user} -g ${cfg.group} ${lnd.networkDir}/admin.macaroon \
|
install --compare -m 640 -o ${cfg.user} -g ${cfg.group} -D ${lnd.networkDir}/admin.macaroon \
|
||||||
'${cfg.dataDir}/macaroons/admin.macaroon'
|
'${cfg.dataDir}/macaroons/admin.macaroon'
|
||||||
|
'')
|
||||||
|
++ optional cfg.nodes.clightning.enable
|
||||||
|
(nbLib.rootScript "rtl-create-clnrest-rune-file" ''
|
||||||
|
rune=$(cat '${clightning.networkDir}/admin-rune')
|
||||||
|
install --compare -m 640 -o ${cfg.user} -g ${cfg.group} <(printf 'LIGHTNING_RUNE="%s"\n' "$rune") '${runePath}'
|
||||||
'');
|
'');
|
||||||
ExecStart = "${nbPkgs.rtl}/bin/rtl";
|
ExecStart = "${nbPkgs.rtl}/bin/rtl";
|
||||||
# Show "rtl" instead of "node" in the journal
|
# Show "rtl" instead of "node" in the journal
|
||||||
|
|
@ -217,10 +227,7 @@ in {
|
||||||
users.users.${cfg.user} = {
|
users.users.${cfg.user} = {
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = cfg.group;
|
group = cfg.group;
|
||||||
extraGroups =
|
extraGroups = optional lndLoopEnabled lnd.group;
|
||||||
# Reads cert and macaroon from the clightning-rest datadir
|
|
||||||
optional cfg.nodes.clightning.enable clightning-rest.group ++
|
|
||||||
optional lndLoopEnabled lnd.group;
|
|
||||||
};
|
};
|
||||||
users.groups.${cfg.group} = {};
|
users.groups.${cfg.group} = {};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue