I messed up my file permissions when I fat fingered a loaded gun in my root directory. The command was
sudo chown -R root:root /
I quickly stopped it when my terminal filled up in horror but not before it changed the ownership and group of half of my file system. The effected directories I noticed were /tmp, /var and /nix. This made it where a number of my system daemons will fail on startup due to file permission errors. For a few of them I was able to track down the files they need and give them ownership back but some of them are trickier than others. Is there a way in nixos or linux to automatically assign the file ownership that things need?