nix-community / impermanence

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

Automatically copy missing paths #137

Open musjj opened 1 year ago

musjj commented 1 year ago

It would be nice if the activation script automatically copies paths to the impermanence root, if the target path exists but the source missing.

This will improve the bootstrapping process on new machines or even when you're just adding new impermanence paths. Impermanence already initializes empty directories automatically which helps a lot. By also doing an auto-copy, the users can have an entirely intervention-free experience.

Though, I guess this won't work for the home directory if you're using home-manager as a NixOS module due to permission issues?

talyz commented 1 year ago

Doing so is unfortunately pretty risky for a running system. You're moving files that are potentially being used by running programs between filesystems. Perhaps it could be alleviated somewhat by using lsof or lsfd and avoid moving open files. Another solution could be a convenience script that the user could run manually to move the files.

prescientmoon commented 10 months ago

Doing so is unfortunately pretty risky for a running system. You're moving files that are potentially being used by running programs between filesystems. Perhaps it could be alleviated somewhat by using lsof or lsfd and avoid moving open files. Another solution could be a convenience script that the user could run manually to move the files.

How about a flag one could set on a per file basis? For a lot of things, this isn't really an issue, so I'd be willing to take the risk.

haru02w commented 7 months ago

Doing so is unfortunately pretty risky for a running system. You're moving files that are potentially being used by running programs between filesystems. Perhaps it could be alleviated somewhat by using lsof or lsfd and avoid moving open files. Another solution could be a convenience script that the user could run manually to move the files.

Or a yes or no option on the activation script to move automatically or not.