make secrets dir location configurable

Users of the nix-bitcoin modules shouldn't be forced to add an extra
dir under root.
The secrets location is unchanged for the default node config.
This commit is contained in:
Erik Arvstedt 2020-01-12 20:52:39 +01:00
parent b1e13e9415
commit 826245484e
No known key found for this signature in database
GPG key ID: 33312B944DD97846
12 changed files with 38 additions and 32 deletions

View file

@ -3,14 +3,18 @@
with lib;
let
cfg = config.nix-bitcoin;
secretsDir = "/secrets/"; # TODO: make this an option
setupSecrets = concatStrings (mapAttrsToList (n: v: ''
setupSecret ${n} ${v.user} ${v.group} ${v.permissions} }
'') cfg.secrets);
in
{
options.nix-bitcoin = {
secretsDir = mkOption {
type = types.path;
default = "/etc/nix-bitcoin-secrets";
description = "Directory to store secrets";
};
secrets = mkOption {
default = {};
type = with types; attrsOf (submodule (
@ -68,7 +72,7 @@ in
processedFiles+=("$file")
}
dir="${secretsDir}"
dir="${cfg.secretsDir}"
if [[ ! -e $dir ]]; then
echo "Error: Secrets dir '$dir' is missing"
exit 1