Common configuration for every host
I'm not sure if this is already possbile, but if not:
I would like to have a way to add configuration that is used for each defined host. For example importing a common module or setting the hostname automatically to the name of the directory containing the configuration.
It's possible by explicitly importing a common module in each hosts configuration. But I think you're asking for an implicit way to do so?
If we do so, we should probably do so not only for nixos, but for darwin, system-manager and maybe home-manager as well. One way would be to special-case a certain module name, i.e. all and then extend our loadHosts functions to always add e.g. modules.nixos.all, modules.darwin.all, etc if that exists.
Personally, I prefer importing everything explicitly as I think there's already too much implicit behavior in NixOS. But the implementation could probably remain minimal so no objection in principle from my side. Curious what others think :)
I'm porting my current nix config to blueprint. In mine I wrap the loading of each host with some things that are common for each host, pretty much setting hostname and importing modules.
I'm no nix expert, but maybe it would be possible to add a hook in the configuration? That would be more explicit than "magic" files.
I'm porting my current nix config to blueprint. In mine I wrap the loading of each host with some things that are common for each host, pretty much setting hostname and importing modules.
I'm no nix expert, but maybe it would be possible to add a hook in the configuration? That would be more explicit than "magic" files.
what do you mean with a hook?