From 4520e1d1f5b511ca53a7655cceb2f9422fc5c5e4 Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 6 Jan 2023 11:56:22 +0000 Subject: [PATCH] persist: auto-map user-provided store values earlier --- modules/persist/computed.nix | 2 +- modules/persist/default.nix | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/persist/computed.nix b/modules/persist/computed.nix index 70591dd1..0f18b190 100644 --- a/modules/persist/computed.nix +++ b/modules/persist/computed.nix @@ -12,7 +12,7 @@ let # set the `store` attribute on one dir attrset fixStore = store: dir: dir // { - store = cfg.stores."${store}"; + inherit store; }; # String -> [a] -> [a] # usually called on an attrset to map (AttrSet [a]) -> [a] diff --git a/modules/persist/default.nix b/modules/persist/default.nix index c830633e..337a2264 100644 --- a/modules/persist/default.nix +++ b/modules/persist/default.nix @@ -52,6 +52,8 @@ let }; }; + coercedToStore = types.coercedTo types.str (s: cfg.stores."${s}") storeType; + # options for a single mountpoint / persistence dirEntryOptions = { options = { @@ -75,7 +77,7 @@ let { options = { store = mkOption { - type = storeType; + type = coercedToStore; }; }; } @@ -85,7 +87,7 @@ let options = { inherit (sane-types.aclOverrideMod.options) user group mode; store = mkOption { - type = storeType; + type = coercedToStore; }; }; };