From 08278afff6e71266c162f80d980fe851060e2a4c Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Sun, 14 Jun 2026 20:43:51 -1000 Subject: [PATCH] users: realpath home dirs before comparison When we create users with homedir under /var, they end up with NFSHomeDirectory under /private/var because /var is a symlink. This breaks consequent activations and requires that user overrides their home dir attribute with /private/var/... to pass the activation precheck. `realpath` should normalize the discrepancy. --- modules/users/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/users/default.nix b/modules/users/default.nix index b491c02..5db7541 100644 --- a/modules/users/default.nix +++ b/modules/users/default.nix @@ -203,7 +203,9 @@ in else homeDirectory=$(dscl . -read ${dsclUser} NFSHomeDirectory) homeDirectory=''${homeDirectory#NFSHomeDirectory: } - if [[ ${escapeShellArg v.home} != "$homeDirectory" ]]; then + configuredHomeDirectory=$(realpath ${escapeShellArg v.home}) + homeDirectory=$(realpath "$homeDirectory") + if [[ "$configuredHomeDirectory" != "$homeDirectory" ]]; then printf >&2 '\e[1;31merror: config contains the wrong home directory for %s, aborting activation\e[0m\n' ${name} printf >&2 'nix-darwin does not support changing the home directory of existing users.\n' printf >&2 '\n'