I use home manager as a nixos module and have multiple users. Home manager controls the configuration for some files in the users home directories, which causes collisions. To prevent home manager from terminating, I created an alias that deletes the files that home manager generates before rebuilding.
sudo rm -rf /home/user1/.config/mimeapps.list &&
sudo rm -rf /home/user1/.local/share/applications/mimeapps.list &&
sudo rm -rf /home/user1/.mozilla/firefox/profiles.ini &&
sudo rm -rf /home/user2/.config/mimeapps.list &&
sudo rm -rf /home/user2/.local/share/applications/mimeapps.list &&
sudo rm -rf /home/user2/.mozilla/firefox/profiles.ini &&
sudo nixos-rebuild switch
The problem with this is that sometimes I’ll have a change to a single users configuration. Home manager will change and overwrite the config files for the user with changes, but not the one without changes. So my alias will delete the config for the un-changed user and they won’t be regenerated. The only way I found to fix this is to make a new change to both users and run my rebuild again.
Is a better way to handle this? Can’t find any information on how to just make home manager ignore collisions. Or maybe I can make my bash alias smarter by detecting changes before deleting?