Is this a good way to modularize home manager home.nix for home/work?

Wha lilyball is doing is more or less what I’m doing too, just in a slightly more roundabout way. In my configuration I split things up based on machine, so my laptop is called uranus and my desktop neptune (I really need better names, my old machine was jupiter and I still cannot remember which machine is which). What I then do is change the $NIX_PATH variable to point to the specific machine configuration (see here). You can extend this in various ways, since I only have two machine at the moment managed with NixOS I just have config options for whether a machine can do x or y (like gaming). I had some initial troubles doing what you did, though nothing requiring merging or diverging sets of packages/settings. I think this would be the how I’d configure the system, check the hostname and conditionally import based on that or use configuration options (like config.mine.work) to conditionally enable things instead of importing. I might be moving towards options myself instead of imports because I occasionally run into corner cases of how I’ve structured my own config.

1 Like