From fca4af59ac04f944b059d56cab1eb51a638f6fdb Mon Sep 17 00:00:00 2001 From: nixbitcoin Date: Thu, 21 Mar 2019 11:27:28 +0100 Subject: [PATCH] Remove mentions of electrs in the bitcoind module, set sysperms & disablewallet only when electrs is enabled, electrs enabled in "all" setting, remove unnecessary newline, make sysperms & disablewallet optional --- modules/bitcoind.nix | 15 ++++++--------- modules/nix-bitcoin.nix | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index 592e977..bf300ba 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -9,9 +9,8 @@ let ${optionalString cfg.testnet "testnet=1"} ${optionalString (cfg.dbCache != null) "dbcache=${toString cfg.dbCache}"} ${optionalString (cfg.prune != null) "prune=${toString cfg.prune}"} - sysperms=${if cfg.sysperms then "1" else "0"} - disablewallet=${if cfg.disablewallet then "1" else "0"} - + ${optionalString (cfg.sysperms != null) "sysperms=${if cfg.sysperms then "1" else "0"}"} + ${optionalString (cfg.disablewallet != null) "disablewallet=${if cfg.disablewallet then "1" else "0"}"} # Connection options ${optionalString (cfg.port != null) "port=${toString cfg.port}"} @@ -155,19 +154,17 @@ in { ''; }; sysperms = mkOption { - type = types.bool; - default = false; + type = types.nullOr types.bool; + default = null; description = '' Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality) - # Necessary for electrs ''; }; disablewallet = mkOption { - type = types.bool; - default = false; + type = types.nullOr types.bool; + default = null; description = '' Do not load the wallet and disable wallet RPC calls - # Necessary for electrs ''; }; dbCache = mkOption { diff --git a/modules/nix-bitcoin.nix b/modules/nix-bitcoin.nix index f614e8a..f7ee4f6 100644 --- a/modules/nix-bitcoin.nix +++ b/modules/nix-bitcoin.nix @@ -78,8 +78,8 @@ in { # bitcoind services.bitcoind.enable = true; services.bitcoind.listen = true; - services.bitcoind.sysperms = true; - services.bitcoind.disablewallet = true; + services.bitcoind.sysperms = if config.services.electrs.enable then true else null; + services.bitcoind.disablewallet = if config.services.electrs.enable then true else null; services.bitcoind.proxy = config.services.tor.client.socksListenAddress; services.bitcoind.port = 8333; services.bitcoind.rpcuser = "bitcoinrpc"; @@ -164,7 +164,7 @@ in { }]; version = 3; }; - services.electrs.enable = true; + services.electrs.enable = cfg.modules == "all"; services.electrs.high-memory = false; services.tor.hiddenServices.electrs = { map = [{