diff --git a/modules/btcpayserver.nix b/modules/btcpayserver.nix index 949cbce..3600930 100644 --- a/modules/btcpayserver.nix +++ b/modules/btcpayserver.nix @@ -14,6 +14,16 @@ in { default = nbPkgs.nbxplorer; description = "The package providing nbxplorer binaries."; }; + address = mkOption { + type = types.str; + default = "127.0.0.1"; + description = "Address to listen on."; + }; + port = mkOption { + type = types.port; + default = 24444; + description = "Port to listen on."; + }; dataDir = mkOption { type = types.path; default = "/var/lib/nbxplorer"; @@ -29,16 +39,6 @@ in { default = cfg.nbxplorer.user; description = "The group as which to run nbxplorer."; }; - bind = mkOption { - type = types.str; - default = "127.0.0.1"; - description = "The address on which to bind."; - }; - port = mkOption { - type = types.port; - default = 24444; - description = "Port on which to bind."; - }; enable = mkOption { # This option is only used by netns-isolation internal = true; @@ -49,6 +49,16 @@ in { btcpayserver = { enable = mkEnableOption "btcpayserver"; + address = mkOption { + type = types.str; + default = "127.0.0.1"; + description = "Address to listen on."; + }; + port = mkOption { + type = types.port; + default = 23000; + description = "Port to listen on."; + }; package = mkOption { type = types.package; default = nbPkgs.btcpayserver; @@ -69,16 +79,6 @@ in { default = cfg.btcpayserver.user; description = "The group as which to run btcpayserver."; }; - bind = mkOption { - type = types.str; - default = "127.0.0.1"; - description = "The address on which to bind."; - }; - port = mkOption { - type = types.port; - default = 23000; - description = "Port on which to bind."; - }; lightningBackend = mkOption { type = types.nullOr (types.enum [ "clightning" "lnd" ]); default = null; @@ -119,7 +119,7 @@ in { btcrpcuser=${cfg.bitcoind.rpc.users.btcpayserver.name} btcrpcurl=http://${config.services.bitcoind.rpc.address}:${toString cfg.bitcoind.rpc.port} btcnodeendpoint=${config.services.bitcoind.address}:${toString config.services.bitcoind.port} - bind=${cfg.nbxplorer.bind} + bind=${cfg.nbxplorer.address} port=${toString cfg.nbxplorer.port} ''; in { @@ -153,9 +153,9 @@ in { network=${config.services.bitcoind.network} postgres=User ID=${cfg.btcpayserver.user};Host=/run/postgresql;Database=btcpaydb socksendpoint=${cfg.tor.client.socksListenAddress} - btcexplorerurl=http://${cfg.nbxplorer.bind}:${toString cfg.nbxplorer.port}/ + btcexplorerurl=http://${cfg.nbxplorer.address}:${toString cfg.nbxplorer.port}/ btcexplorercookiefile=${cfg.nbxplorer.dataDir}/${config.services.bitcoind.makeNetworkName "Main" "RegTest"}/.cookie - bind=${cfg.btcpayserver.bind} + bind=${cfg.btcpayserver.address} ${optionalString (cfg.btcpayserver.rootpath != null) "rootpath=${cfg.btcpayserver.rootpath}"} port=${toString cfg.btcpayserver.port} '' + optionalString (cfg.btcpayserver.lightningBackend == "clightning") '' diff --git a/modules/netns-isolation.nix b/modules/netns-isolation.nix index 03501c6..529d745 100644 --- a/modules/netns-isolation.nix +++ b/modules/netns-isolation.nix @@ -280,8 +280,8 @@ in { services.lightning-loop.rpcAddress = netns.lightning-loop.address; - services.nbxplorer.bind = netns.nbxplorer.address; - services.btcpayserver.bind = netns.btcpayserver.address; + services.nbxplorer.address = netns.nbxplorer.address; + services.btcpayserver.address = netns.btcpayserver.address; services.joinmarket.cliExec = mkCliExec "joinmarket"; systemd.services.joinmarket-yieldgenerator.serviceConfig.NetworkNamespacePath = "/var/run/netns/nb-joinmarket"; diff --git a/modules/presets/secure-node.nix b/modules/presets/secure-node.nix index 9417bcc..8a6bda2 100644 --- a/modules/presets/secure-node.nix +++ b/modules/presets/secure-node.nix @@ -103,7 +103,7 @@ in { # disable tor enforcement until btcpayserver can fetch rates over Tor services.btcpayserver.enforceTor = false; services.nbxplorer.enforceTor = true; - services.tor.hiddenServices.btcpayserver = mkIf cfg.btcpayserver.enable (mkHiddenService { port = 80; toPort = 23000; toHost = cfg.btcpayserver.bind; }); + services.tor.hiddenServices.btcpayserver = mkIf cfg.btcpayserver.enable (mkHiddenService { port = 80; toPort = 23000; toHost = cfg.btcpayserver.address; }); services.spark-wallet = { onion-service = true;