Open mairs8 opened 6 months ago
I am having a similar issue where persisting files works fine, but directories are not linked/mounted. Did you figure this out?
I had a permissions issue in which the Home Manager Impermanence module does not have permission to create each users' home folders in /home
(e.g. /home/billy
).
I use this systemd service to ensure each users' home folders exist:
systemd.services."persist-home-create-root-paths" =
let
persistentHomesRoot = "/persist";
listOfCommands = l.mapAttrsToList
(_: user:
let
userHome = l.escapeShellArg (persistentHomesRoot + user.home);
in ''
if [[ ! -d ${userHome} ]]; then
echo "Persistent home root folder '${userHome}' not found, creating..."
mkdir -p --mode=${user.homeMode} ${userHome}
chown ${user.name}:${user.group} ${userHome}
fi
''
)
(l.filterAttrs (_: user: user.createHome == true) config.users.users);
stringOfCommands = l.concatLines listOfCommands;
in {
script = stringOfCommands;
unitConfig = {
Description = "Ensure users' home folders exist in the persistent filesystem";
PartOf = [ "local-fs.target" ];
# The folder creation should happen after the persistent home path is mounted.
After = [ "persist-home.mount" ];
};
serviceConfig = {
Type = "oneshot";
StandardOutput = "journal";
StandardError = "journal";
};
# [Install]
wantedBy = [ "local-fs.target" ];
};
Had the same problem fixed with the systemd services! Is there a complete fix on the way? @talyz
For now, I would recommend using the NixOS module with the users
option instead of the home-manager module to solve this issue. The problem is that home-manager runs as the user and only has its permissions, so it can't create the initial user home directory.
i am having a nightmare trying to get the home-manager impermanence module to work. keep getting permission denied error and it does not appear to be mounting the home files to my /persist/home location. i am trying below but it is not a good approach and still i get error on the files now 'failed to create symbolic link '/home/billy/.config/gh/config.yml': Permission denied'. what am i doing wrong? is there a better way to do this? do i get same error if i was to use zfs over btrfs?
example of what i am doing for home persistence. is this not following best practices?