From fffe988248fcb48fe0a58214aa96b2900c92309b Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Thu, 14 Jan 2021 13:24:16 +0100 Subject: [PATCH] onionAddresses: add readonly option 'dataDir' Used by 'onionServices' in a later commit for services that announce their onion address. --- modules/onion-addresses.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/onion-addresses.nix b/modules/onion-addresses.nix index 905f73d..f715337 100644 --- a/modules/onion-addresses.nix +++ b/modules/onion-addresses.nix @@ -11,7 +11,6 @@ with lib; let cfg = config.nix-bitcoin.onionAddresses; inherit (config) nix-bitcoin-services; - dataDir = "/var/lib/onion-addresses/"; in { options.nix-bitcoin.onionAddresses = { access = mkOption { @@ -28,6 +27,10 @@ in { /var/lib/onion-addresses/myuser. ''; }; + dataDir = mkOption { + readOnly = true; + default = "/var/lib/onion-addresses"; + }; }; config = mkIf (cfg.access != {}) { @@ -47,7 +50,7 @@ in { # Wait until tor is up until [[ -e /var/lib/tor/state ]]; do sleep 0.1; done - cd ${dataDir} + cd ${cfg.dataDir} rm -rf * ${concatMapStrings