refactor the dirsSubModule type so that we don't reference 'config.sane.persist' while creating options

This commit is contained in:
2023-01-06 10:35:32 +00:00
parent 837e5438c3
commit a95b91a556

View File

@@ -81,20 +81,12 @@ let
}
];
# this submodule creates one attr per store, so that the user can specify something like:
# attrset from { "${storeName}" = [ dirEntry ] }
# the user can specify something like:
# <option>.private.".cache/vim" = { mode = "0700"; };
# to place ".cache/vim" into the private store and create with the appropriate mode
dirsSubModule = types.submodule {
options = mapAttrs (store: store-cfg: mkOption {
default = [];
type = types.listOf contextualizedDirOrShorthand;
description = let
suffix = if store-cfg.storeDescription != null then
": ${store-cfg.storeDescription}"
else "";
in "directories to persist in ${store}${suffix}";
}) cfg.stores;
};
dirsSubModule = types.attrsOf (types.listOf contextualizedDirOrShorthand);
dirsModule = types.submodule ({ config, ... }: {
options = {