I am trying to figure out how to pass variables between submodules of my configuration.nix… been struggling a long time but no luck. In this case it is the hostname and I first tried with config.networing.hostName but not found. I’ve tried to make it more general but still no good. How could I make this work? And how would I do it if I didn’t have a dedicated variable hostname but just used config.networking.hostName?
error: The option `hostname' does not exist. Definition values:
- In `/.../configuration.nix': "thinkpad-nixos"
(use '--show-trace' to show detailed location information)
Though home manager specifically also provides osConfig or systemConfig, I never remember the exact name, to be able to access the systems configuration.
Another option although not quite as clean is to have a different file per machine that just sets a HOSTNAME variable and then use that to refer to the hostname via config.home.sessionVariables.HOSTNAME.