From 8b053326ccb9b08b585d65f54ad12ddbf86c1ff2 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 29 Oct 2020 21:20:32 +0100 Subject: [PATCH] bitcoind: use type str for rpcbind Extra RPC bind addresses can still be added via extraConfig. --- modules/bitcoind.nix | 8 ++++---- modules/btcpayserver.nix | 2 +- modules/clightning.nix | 2 +- modules/electrs.nix | 2 +- modules/joinmarket.nix | 2 +- modules/liquid.nix | 2 +- modules/lnd.nix | 2 +- modules/netns-isolation.nix | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index 14930ce..c3021d1 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -39,8 +39,8 @@ let "rpcwhitelist=${user.name}:${lib.strings.concatStringsSep "," user.rpcwhitelist}"} '') (builtins.attrValues cfg.rpc.users) } - ${lib.concatMapStrings (rpcbind: "rpcbind=${rpcbind}\n") cfg.rpcbind} - rpcconnect=${builtins.elemAt cfg.rpcbind 0} + rpcbind=${cfg.rpcbind} + rpcconnect=${cfg.rpcbind} ${lib.concatMapStrings (rpcallowip: "rpcallowip=${rpcallowip}\n") cfg.rpcallowip} # Wallet options @@ -150,8 +150,8 @@ in { description = "Set the number of threads to service RPC calls"; }; rpcbind = mkOption { - type = types.listOf types.str; - default = [ "127.0.0.1" ]; + type = types.str; + default = "127.0.0.1"; description = '' Bind to given address to listen for JSON-RPC connections. ''; diff --git a/modules/btcpayserver.nix b/modules/btcpayserver.nix index f720076..46ed39e 100644 --- a/modules/btcpayserver.nix +++ b/modules/btcpayserver.nix @@ -112,7 +112,7 @@ in { configFile = builtins.toFile "config" '' network=${config.services.bitcoind.network} btcrpcuser=${cfg.bitcoind.rpc.users.btcpayserver.name} - btcrpcurl=http://${builtins.elemAt config.services.bitcoind.rpcbind 0}:${toString cfg.bitcoind.rpc.port} + btcrpcurl=http://${config.services.bitcoind.rpcbind}:${toString cfg.bitcoind.rpc.port} btcnodeendpoint=${config.services.bitcoind.bind}:8333 bind=${cfg.nbxplorer.bind} port=${toString cfg.nbxplorer.port} diff --git a/modules/clightning.nix b/modules/clightning.nix index 7f50901..4b1c0d4 100644 --- a/modules/clightning.nix +++ b/modules/clightning.nix @@ -13,7 +13,7 @@ let ${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"} always-use-proxy=${if cfg.always-use-proxy then "true" else "false"} bind-addr=${cfg.bind-addr}:${toString cfg.bindport} - bitcoin-rpcconnect=${builtins.elemAt config.services.bitcoind.rpcbind 0} + bitcoin-rpcconnect=${config.services.bitcoind.rpcbind} bitcoin-rpcport=${toString config.services.bitcoind.rpc.port} bitcoin-rpcuser=${config.services.bitcoind.rpc.users.public.name} rpc-file-mode=0660 diff --git a/modules/electrs.nix b/modules/electrs.nix index 83511fb..f1f5899 100644 --- a/modules/electrs.nix +++ b/modules/electrs.nix @@ -97,7 +97,7 @@ in { --daemon-dir='${bitcoind.dataDir}' \ --electrum-rpc-addr=${cfg.address}:${toString cfg.port} \ --monitoring-addr=${cfg.address}:${toString cfg.monitoringPort} \ - --daemon-rpc-addr=${builtins.elemAt bitcoind.rpcbind 0}:${toString bitcoind.rpc.port} \ + --daemon-rpc-addr=${bitcoind.rpcbind}:${toString bitcoind.rpc.port} \ ${cfg.extraArgs} ''; User = cfg.user; diff --git a/modules/joinmarket.nix b/modules/joinmarket.nix index d1d2248..e30dd35 100644 --- a/modules/joinmarket.nix +++ b/modules/joinmarket.nix @@ -20,7 +20,7 @@ let [BLOCKCHAIN] blockchain_source = bitcoin-rpc network = ${bitcoind.network} - rpc_host = ${builtins.elemAt bitcoind.rpcbind 0} + rpc_host = ${bitcoind.rpcbind} rpc_port = ${toString bitcoind.rpc.port} rpc_user = ${bitcoind.rpc.users.privileged.name} @@RPC_PASSWORD@@ diff --git a/modules/liquid.nix b/modules/liquid.nix index 15f296b..8d59b72 100644 --- a/modules/liquid.nix +++ b/modules/liquid.nix @@ -31,7 +31,7 @@ let ${lib.concatMapStrings (rpcallowip: "rpcallowip=${rpcallowip}\n") cfg.rpcallowip} ${optionalString (cfg.rpcuser != null) "rpcuser=${cfg.rpcuser}"} ${optionalString (cfg.rpcpassword != null) "rpcpassword=${cfg.rpcpassword}"} - mainchainrpchost=${builtins.elemAt config.services.bitcoind.rpcbind 0} + mainchainrpchost=${config.services.bitcoind.rpcbind} mainchainrpcport=${toString config.services.bitcoind.rpc.port} mainchainrpcuser=${config.services.bitcoind.rpc.users.public.name} diff --git a/modules/lnd.nix b/modules/lnd.nix index ae8f1a6..b4eac5b 100644 --- a/modules/lnd.nix +++ b/modules/lnd.nix @@ -8,7 +8,7 @@ let secretsDir = config.nix-bitcoin.secretsDir; bitcoind = config.services.bitcoind; - bitcoindRpcAddress = builtins.elemAt bitcoind.rpcbind 0; + bitcoindRpcAddress = bitcoind.rpcbind; onion-chef-service = (if cfg.announce-tor then [ "onion-chef.service" ] else []); networkDir = "${cfg.dataDir}/chain/bitcoin/${bitcoind.network}"; configFile = pkgs.writeText "lnd.conf" '' diff --git a/modules/netns-isolation.nix b/modules/netns-isolation.nix index aa32e2c..12c61be 100644 --- a/modules/netns-isolation.nix +++ b/modules/netns-isolation.nix @@ -252,7 +252,7 @@ in { services.bitcoind = { bind = netns.bitcoind.address; - rpcbind = [ netns.bitcoind.address ]; + rpcbind = netns.bitcoind.address; rpcallowip = [ bridgeIp # For operator user netns.bitcoind.address