{ lib, ... }: let cfg = config.networking; in { options = { # from https://github.com/NixOS/nixpkgs/blob/799ba5bffed04ced7067a91798353d360788b30d/nixos/modules/tasks/network-interfaces.nix networking.hostName = mkOption { default = config.system.nixos.distroId; defaultText = literalExpression "config.system.nixos.distroId"; type = types.strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$"; }; networking.fqdn = mkOption { readOnly = true; type = types.str; default = if (cfg.hostName != "" && cfg.domain != null) then "${cfg.hostName}.${cfg.domain}" else throw '' The FQDN is required but cannot be determined. Please make sure that both networking.hostName and networking.domain are set properly. ''; defaultText = literalExpression ''"''${networking.hostName}.''${networking.domain}"''; description = '' The fully qualified domain name (FQDN) of this host. It is the result of combining `networking.hostName` and `networking.domain.` Using this option will result in an evaluation error if the hostname is empty or no domain is specified. Modules that accept a mere `networking.hostName` but prefer a fully qualified domain name may use `networking.fqdnOrHostName` instead. ''; }; }; }