Make default vaultix.cache derive dynamically from defaultSecretDirectory
Feature Request / Suggestion
Currently in flake-module.nix, both cache and defaultSecretDirectory have independent hardcoded defaults:
cache = mkOption {
type = ...;
default = "./secrets/cache";
};
defaultSecretDirectory = mkOption {
type = ...;
default = "./secrets";
};
Problem
When a user configures a custom vaultix.defaultSecretDirectory (for example, ./nix/secrets or ./nix/users/<user>/secrets), vaultix.cache remains statically pointed to ./secrets/cache.
As a consequence, running vaultix.app.<system>.renc automatically creates ./secrets/cache at the repository root unless vaultix.cache is also manually and redundantly configured.
Proposed Solution
Derive the default value of cache from submod.config.defaultSecretDirectory:
cache = mkOption {
type = types.addCheck types.str (s: (builtins.substring 0 1 s) == ".") // {
description = "path string relative to flake root";
};
default = "${submod.config.defaultSecretDirectory}/cache";
defaultText = lib.literalExpression ''"''${defaultSecretDirectory}/cache"'';
description = ''
`path str` relative to flake root, used for storing host public key
re-encrypted secrets.
'';
};
This keeps configuration DRY and ensures changing defaultSecretDirectory automatically relocates the re-encryption cache, while keeping the default ./secrets/cache behavior when defaultSecretDirectory is unchanged.