I find myself often adding stuff like this at the beginning of my role files in NixOS configuration:
let
fqdn = with config.networking; "${hostName}.${domain}";
in {
Which is quite a mouthful if you want to use the host fqdn in multiple places. How would I go about making this more easily available in my nixos config files?
One way I came up with was to add an overlay with fqdn in it:
This allows me to access it via pkgs.fqdn in any file, but it does seem a bit awkward, as that kind of information should not live under pkgs. Is there a better way to achieve this?
In theory you could even move the assignment to default of the mkOption, and override the FQDN elsewhere in a hosts config if necessary for some reason.