From 36537763995702813ab8ec761c9acd780d72dc01 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 30 Jan 2023 11:06:47 +0000 Subject: [PATCH] cleanup: modules/users.nix: allow explicitly setting `home`, if needed --- modules/users.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/users.nix b/modules/users.nix index 1b7a9159..ca9765e6 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -27,7 +27,7 @@ let }; }; }; - userModule = types.submodule ({ config, ... }: { + userModule = types.submodule ({ name, config, ... }: { options = userOptions.options // { default = mkOption { type = types.bool; @@ -37,6 +37,13 @@ let this option determines what the `sane.user` shorthand evaluates to. ''; }; + + home = mkOption { + type = types.str; + # XXX: we'd prefer to set this to `config.users.users.home`, but that causes infinite recursion... + # TODO: maybe assert that this matches the actual home? + default = "/home/${name}"; + }; }; # if we're the default user, inherit whatever settings were routed to the default user @@ -45,8 +52,7 @@ let processUser = user: defn: let prefixWithHome = mapAttrs' (path: value: { - # TODO: query the user's home dir! - name = path-lib.concat [ "/home/${user}" path ]; + name = path-lib.concat [ defn.home path ]; inherit value; }); in