nix-community / impermanence

Modules to help you handle persistent state on systems with ephemeral root storage [maintainer=@talyz]
MIT License
1.09k stars 80 forks source link

File created before being symlinked #59

Closed a12l closed 2 years ago

a12l commented 2 years ago

When I want to add the file ~/.config/user-dirs.dirs to my persistent storage, I first delete the file; and then add it to the home.persistence."/persistent/home/a12l"/files list. After doing a simple ls -l ~/.config/user-dirs.dirs I can verify that the file gets symlinked.

But when I reboot I find a normal file at ~/.config/user-dirs.dirs. At the same time, other files in ~/.config that is listed in the home.persistence."/persistent/home/a12l"/files list is symlinked.

What should I do?

talyz commented 2 years ago

Could you try out #62? If the problem is that the file is created earlier in the session, that might help. Otherwise, I'm not sure. I'll also be looking into providing a non-home-manager alternative for user files, which could also solve the issue.

a12l commented 2 years ago

Could you try out #62? If the problem is that the file is created earlier in the session, that might help. Otherwise, I'm not sure.

It seems that I was mistaken. I believe that the utility xdg-user-dirs-update is run if the user-dirs.dirs file doesn't exist or doesn't contain everything it should. Before xdg-user-dirs-update creates the new user-dirs.dirs file, it removes the symlink, for some reason (instead of just creating the template file). But if I manually create the file and populate it with the content of the template, it's kept at boot.

I'll also be looking into providing a non-home-manager alternative for user files, which could also solve the issue.

Interesting! Do you have any details?

talyz commented 2 years ago

Interesting! Do you have any details?

Yes, the details are in #70 which is now merged. The usage is documented in the readme.