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

Speed up `setting up /etc...' #89

Open shadowrylander opened 2 years ago

shadowrylander commented 2 years ago

Hello! Sorry, it's me again! 😅

Is there any way to speed up setting up /etc..., or is it unavoidable with a lot of files and directories to bind-mount?

Thank you kindly for the information!

talyz commented 2 years ago

Hi! That prompt isn't specific to impermanence. It's still possible that setting up bind mounts and symlinks is what's causing a slowdown when you're activating a new generation, but this would have to be profiled somehow. I don't see any easy way to improve that either - the scripts aren't doing anything that fancy or superfluous. The create-directories script checks the hierarchy of all added directories and files' parent directories, but I don't see any obvious way around that which wouldn't increase complexity immensely.

shadowrylander commented 2 years ago

Hmm... This might actually tie into my other issue here, whereupon adding /etc/ssh to the persistent directories prevents sshd_config from being generated; is it possible that that might be causing this immense slowdown?

shadowrylander commented 2 years ago

Also, if no subdirectories are mounted in /persist, such as directories = [ "/directory" "/directory/subdirectory" ];, would it not be possible to parallelize the command, such as using async, since there would be no race conditions?

Sorry if I'm misunderstanding something here!