persist: auto-map user-provided store values earlier

This commit is contained in:
colin 2023-01-06 11:56:22 +00:00
parent 841a2a3bcb
commit 4520e1d1f5
2 changed files with 5 additions and 3 deletions

View File

@ -12,7 +12,7 @@ let
# set the `store` attribute on one dir attrset # set the `store` attribute on one dir attrset
fixStore = store: dir: dir // { fixStore = store: dir: dir // {
store = cfg.stores."${store}"; inherit store;
}; };
# String -> [a] -> [a] # String -> [a] -> [a]
# usually called on an attrset to map (AttrSet [a]) -> [a] # usually called on an attrset to map (AttrSet [a]) -> [a]

View File

@ -52,6 +52,8 @@ let
}; };
}; };
coercedToStore = types.coercedTo types.str (s: cfg.stores."${s}") storeType;
# options for a single mountpoint / persistence # options for a single mountpoint / persistence
dirEntryOptions = { dirEntryOptions = {
options = { options = {
@ -75,7 +77,7 @@ let
{ {
options = { options = {
store = mkOption { store = mkOption {
type = storeType; type = coercedToStore;
}; };
}; };
} }
@ -85,7 +87,7 @@ let
options = { options = {
inherit (sane-types.aclOverrideMod.options) user group mode; inherit (sane-types.aclOverrideMod.options) user group mode;
store = mkOption { store = mkOption {
type = storeType; type = coercedToStore;
}; };
}; };
}; };