I am new to NixOS, I used this guide for setting up root impermanence: Nixos and Erasing My Darlings · hanckmann.com
The Problem
home-manager-user.service fails to symlink files, due to my home folder being owned by root.
× home-manager-alexander.service - Home Manager environment for alexander
Loaded: loaded (/etc/systemd/system/home-manager-alexander.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-04-19 09:28:15 CEST; 69ms ago
Process: 7680 ExecStart=/nix/store/sjl004ksn059xz9yfhj7haap24jv3s09-hm-setup-env /nix/store/36h898zmw613k31y411r1dqdl1i9by9s-home-manager-generation (code=exited, status=1/FAILURE)
Main PID: 7680 (code=exited, status=1/FAILURE)
IP: 0B in, 0B out
CPU: 390ms
Apr 19 09:28:14 axolotl hm-activate-alexander[7680]: Activating installPackages
Apr 19 09:28:14 axolotl hm-activate-alexander[7680]: Activating dconfSettings
Apr 19 09:28:14 axolotl hm-activate-alexander[7680]: Activating linkGeneration
Apr 19 09:28:14 axolotl hm-activate-alexander[7680]: Cleaning up orphan links from /home/alexander
Apr 19 09:28:14 axolotl hm-activate-alexander[7680]: No change so reusing latest profile generation 9
Apr 19 09:28:14 axolotl hm-activate-alexander[7680]: Creating home file links in /home/alexander
Apr 19 09:28:15 axolotl hm-activate-alexander[8090]: ln: failed to create symbolic link '/home/alexander/.face': Permission denied
Apr 19 09:28:15 axolotl systemd[1]: home-manager-alexander.service: Main process exited, code=exited, status=1/FAILURE
Apr 19 09:28:15 axolotl systemd[1]: home-manager-alexander.service: Failed with result 'exit-code'.
Apr 19 09:28:15 axolotl systemd[1]: Failed to start Home Manager environment for alexander.
warning: error(s) occurred while switching to the new configuration
Below is how I setup my user. At first I didn’t specify a uid, and then when I did it fixed it. But now as I was tinkering with setting up zsh in another module, the problem came back.It almost feels like a race condition?
users.users.${cfg.name} =
{
isNormalUser = true;
inherit (cfg) name initialHashedPassword;
home = "/home/${cfg.name}";
group = "users";
ignoreShellProgramCheck = true;
uid = 1000;
extraGroups = [ "wheel" "audio" "sound" "video" "networkmanager" "input" "tty" "docker" ] ++ cfg.extraGroups;
} // cfg.extraOptions;
What i’ve tried:
Setting uid=1000 as an option when mounting /home
Manually chown the home dir.
Set users.users..createHome = true;
What could/is the cause of this and how can I fix it?
Looking forward to hear any ideas.
Thanks in advance.
Edit:
Forgot to include relevant metadata:
NixOS 24.05 (Uakari)
Kernel: 6.6.26
StateVersion: 23.11