Can I set XDG_CONFIG_HOME to a nix store path to maintain user config?

I’m not sure if this is a feasible solution. Maybe it’s better to wrap single binary with this env var.

This seems like an interesting idea, but it may be unworkable in practice. Many apps expect write access to XDG_CONFIG_HOME, often using it for their cache. Many apps do not respect XDG_CONFIG_HOME; although support seems to be improving slowly.

To get a feel for some of the pain points, try managing your XDG_CONFIG_HOME content using git. You will quickly see how the content changes unexpectedly, and you will get a sense of the effort needed to manage those files in the store. If that works for you, then converting the git repo to a store package wouldn’t be too much more effort.

That sound interesting and doable! At least I can find which programs can be wrapped.