onionAddresses: add readonly option 'dataDir'

Used by 'onionServices' in a later commit for services that announce
their onion address.
This commit is contained in:
Erik Arvstedt 2021-01-14 13:24:16 +01:00
parent 5f34b094d3
commit fffe988248
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -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