How to determine why nixos-rebuild restarted systemd services

Is there a way to figure out why nixos-rebuild switch sometimes restarts the world (i.e. almost all systemd services)? I’m fine with waiting for the nightly update to restart things when I am not using them, in the general case. But especially while testing changes to nixos modules I somewhat frequently encounter restart the world events, while the second try (improving on the first) then skips over the restarts. Is it possible to get some kind of debug output that shows me the dependency chain that triggered the restarts?

Some services seem to depend on config.system.path which will change if you install/update packages. Quick remedy for the issue would be to set systemd.services.<name>.restartIfChanged to false but the proper way should be to stop using config.system.path in servies where it isn’t actually necessary.