Udev rule updates without rebooting

ISTM that currently doing nixos-rebuild switch will not retrigger udev rules (e.g. via udevadm trigger --settle). I wonder whether it should.

An advantage for that would be that switch would more closely resemble the environment one would get after boot and a reboot (though would not handle cases where a rule was removed but its effect will persist – only where a rule was changed, added, or a rule was removed that was overriding another rule).

A possible disadvantage might be that, if one relies on udevd triggering rules once (and e.g. “manually” reaches in and changes things afterwards) their expectations will be broken during switch. Though I’m not sure whether such expectations are in any way reasonable.

What do y’all think?

1 Like

Sounds like a good idea to me – I like nixos-rebuild switch being as close as possible to a nixos-rebuild boot && reboot.

Side note: when I run sudo udevadm trigger --settle on my laptop it frequently hangs. (I tried on a 2nd laptop and the hangs were much less frequent, but still managed to observe it after 100+ runs.)