clightning: add netns

- Adds clightning to netns-isolation.services
- Adds bitcoin-rpcconnect option to allow using clightning with network
  namespaces
- Uses bind-addr option (defaults to localhost) as target of hidden service
- Adds different bind-addr options depending on if netns-isolation is
  enabled or not.
This commit is contained in:
nixbitcoin 2020-06-10 14:31:38 +00:00
parent ae1230e13b
commit 3c0c446547
No known key found for this signature in database
GPG key ID: DD11F9AD5308B3BA
3 changed files with 19 additions and 2 deletions

View file

@ -88,6 +88,10 @@ in {
bitcoind = {
id = 12;
};
clightning = {
id = 13;
connections = [ "bitcoind" ];
};
};
systemd.services = {
@ -181,9 +185,17 @@ in {
'';
};
# clightning: Custom netns configs
services.clightning = mkIf config.services.clightning.enable {
bitcoin-rpcconnect = netns.bitcoind.address;
bind-addr = "${netns.clightning.address}:${toString config.services.clightning.onionport}";
};
})
# Custom netns config option values if netns-isolation not enabled
(mkIf (!cfg.enable) {
# clightning
services.clightning.bind-addr = "127.0.0.1:${toString config.services.clightning.onionport}";
})
];
}