diff --git a/modules/persist/computed.nix b/modules/persist/computed.nix index 1ba91413..908761b7 100644 --- a/modules/persist/computed.nix +++ b/modules/persist/computed.nix @@ -1,18 +1,8 @@ -{ config, lib, sane-lib, ... }: +{ config, ... }: let - path = sane-lib.path; cfg = config.sane.persist; - - withPrefix = relativeTo: entries: lib.mapAttrs' (fspath: value: { - name = path.concat [ relativeTo fspath ]; - inherit value; - }) entries; in { - # merge the `byPath` mappings from both `home` and `sys` into one namespace - sane.persist.byPath = lib.mkMerge [ - (withPrefix "/home/colin" cfg.home.byPath) - (withPrefix "/" cfg.sys.byPath) - ]; + sane.persist.byPath = cfg.sys.byPath; } diff --git a/modules/persist/default.nix b/modules/persist/default.nix index 751bf476..804fbf9b 100644 --- a/modules/persist/default.nix +++ b/modules/persist/default.nix @@ -179,11 +179,6 @@ in type = types.bool; description = "define / fs root to be a tmpfs. make sure to mount some other device to /nix"; }; - sane.persist.home = mkOption { - description = "directories to persist to disk, relative to a user's home ~"; - default = {}; - type = dirsSubModule; - }; sane.persist.sys = mkOption { description = "directories to persist to disk, relative to the fs root /"; default = {}; diff --git a/modules/users.nix b/modules/users.nix index 75ff37d9..1b7a9159 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -19,10 +19,10 @@ let }; persist = mkOption { - type = options.sane.persist.home.type; + type = options.sane.persist.sys.type; default = {}; description = '' - entries to pass onto `sane.persist.home` + entries to pass onto `sane.persist.sys` after prepending the user's home-dir to the path. ''; }; }; @@ -42,14 +42,20 @@ let # if we're the default user, inherit whatever settings were routed to the default user config = mkIf config.default sane-user-cfg; }); - processUser = user: defn: { - sane.fs = mapAttrs' (path: value: { - # TODO: query the user's home dir! - name = path-lib.concat [ "/home/${user}" path ]; - inherit value; - }) defn.fs; - sane.persist.home = defn.persist; - }; + processUser = user: defn: + let + prefixWithHome = mapAttrs' (path: value: { + # TODO: query the user's home dir! + name = path-lib.concat [ "/home/${user}" path ]; + inherit value; + }); + in + { + sane.fs = prefixWithHome defn.fs; + + # `byPath` is the actual output here, computed from the other keys. + sane.persist.sys.byPath = prefixWithHome defn.persist.byPath; + }; in { options = { @@ -78,7 +84,7 @@ in num-default-users = count (u: u.default) (attrValues cfg); take = f: { sane.fs = f.sane.fs; - sane.persist = f.sane.persist; + sane.persist.sys.byPath = f.sane.persist.sys.byPath; }; in mkMerge [ (take (sane-lib.mkTypedMerge take configs))