I haven’t taken the plunge into home manager yet, but I’ve done this with my /etc/nixos/configuration.nix.
My approach is to keep my configuration in a git repo, with clones on my home and work machines.
I have an import like adminInfo = import ./admin-info.nix {}; in configuration.nix. And I have two files in the repo:
home-admin-info.nix:
{}:
{
user = "matt";
hostName = "alpha";
domain = "mchenryfamily.org";
}
work-admin-info.nix:
{}:
{
user = "mmchenry";
hostName = "mmchenry-nixos";
domain = "work.com";
}
The only thing that’s not version controlled in git is the admin-info.nix symlink, which points to the appropriate *-admin-info.nix on each machine.
Then elsewhere in configuration.nix, I can refer to these variables, e.g. networking.hostName = adminInfo.hostName.
I also have hardware-configuration.nix symlinked to home-hardware-info.nix or work-hardware-info.nix, since the machines need different kernel modules etc.