Merge branch 'nixbitcoin-clightning-tor'

This commit is contained in:
Jonas Nick 2019-03-07 16:19:02 +00:00
commit 8b9c9bd70a
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
2 changed files with 23 additions and 0 deletions

View File

@ -7,6 +7,9 @@ let
configFile = pkgs.writeText "config" '' configFile = pkgs.writeText "config" ''
autolisten=${if cfg.autolisten then "true" else "false"} autolisten=${if cfg.autolisten then "true" else "false"}
network=bitcoin network=bitcoin
${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"}
always-use-proxy=${if cfg.always-use-proxy then "true" else "false"}
${optionalString (cfg.bind-addr != null) "bind-addr=${cfg.bind-addr}"}
bitcoin-rpcuser=${cfg.bitcoin-rpcuser} bitcoin-rpcuser=${cfg.bitcoin-rpcuser}
''; '';
in { in {
@ -25,6 +28,23 @@ in {
If enabled, the clightning service will listen. If enabled, the clightning service will listen.
''; '';
}; };
proxy = mkOption {
type = types.nullOr types.string;
default = null;
description = "Set a socks proxy to use to connect to Tor nodes (or for all connections if *always-use-proxy* is set)";
};
always-use-proxy = mkOption {
type = types.bool;
default = false;
description = ''
Always use the *proxy*, even to connect to normal IP addresses (you can still connect to Unix domain sockets manually). This also disables all DNS lookups, to avoid leaking information.
'';
};
bind-addr = mkOption {
type = types.nullOr types.string;
default = null;
description = "Set an IP address or UNIX domain socket to listen to";
};
bitcoin-rpcuser = mkOption { bitcoin-rpcuser = mkOption {
type = types.string; type = types.string;
description = '' description = ''

View File

@ -104,6 +104,9 @@ in {
enable = true; enable = true;
bitcoin-rpcuser = config.services.bitcoind.rpcuser; bitcoin-rpcuser = config.services.bitcoind.rpcuser;
}; };
services.clightning.proxy = config.services.tor.client.socksListenAddress;
services.clightning.always-use-proxy = true;
services.clightning.bind-addr = "127.0.0.1:9735";
services.tor.hiddenServices.clightning = { services.tor.hiddenServices.clightning = {
map = [{ map = [{
port = 9375; toPort = 9375; port = 9375; toPort = 9375;