I do this, but instead of a directory per host, I have a branch per host.
All the stuff in the common directory (usually) only gets edited on the main branch, and merged to each host as they’re updated.
This means I can still have divergences on the per-host branch in the common files if needed.
I try and avoid it, and take it as a code smell that the common module is insufficiently general, but it lets me separate the change that identifies that need from the change that fixes the wrinkle.
This is slightly more cognitive load, but it works for me, and I chose this method when I was first starting out with nixos, because I knew how to maintain code branches and didn’t know how to make nix code conditional in the ways I might need.
I’m not likely to change this method until I migrate to system flakes, where the hostname ⇒ configuration lookup is automatically supported. I haven’t done that yet, mainly for two reasons:
This is (so far) the only compelling reason I can see to make the switch, and what I have works well until some other reason comes along.
I have a nagging feeling that I would probably want to keep separate branches for each host anyway, to track the flake.lock file for each host, since moving that from the channel update into the repo for more reproducible configs is another point of flakes.