···54545555 hostName = lib.mkOption {
5656 type = lib.types.str;
5757- default = if config.networking.domain != null then
5858- config.networking.fqdn
5959- else
6060- config.networking.hostName;
6161- defaultText = lib.literalExpression "config.networking.fqdn";
5757+ default = config.networking.fqdnOrHostName;
5858+ defaultText = lib.literalExpression "config.networking.fqdnOrHostName";
6259 example = "snipe-it.example.com";
6360 description = lib.mdDoc ''
6461 The hostname to serve Snipe-IT on.
+21-1
nixos/modules/tasks/network-interfaces.nix
···473473 defaultText = literalExpression ''"''${networking.hostName}.''${networking.domain}"'';
474474 description = lib.mdDoc ''
475475 The fully qualified domain name (FQDN) of this host. It is the result
476476- of combining networking.hostName and networking.domain. Using this
476476+ of combining `networking.hostName` and `networking.domain.` Using this
477477 option will result in an evaluation error if the hostname is empty or
478478 no domain is specified.
479479+480480+ Modules that accept a mere `networing.hostName` but prefer a fully qualified
481481+ domain name may use `networking.fqdnOrHostName` instead.
482482+ '';
483483+ };
484484+485485+ networking.fqdnOrHostName = mkOption {
486486+ readOnly = true;
487487+ type = types.str;
488488+ default = if cfg.domain == null then cfg.hostName else cfg.fqdn;
489489+ defaultText = literalExpression ''
490490+ if cfg.domain == null then cfg.hostName else cfg.fqdn
491491+ '';
492492+ description = lib.mdDoc ''
493493+ Either the fully qualified domain name (FQDN), or just the host name if
494494+ it does not exists.
495495+496496+ This is a convenience option for modules to read instead of `fqdn` when
497497+ a mere `hostName` is also an acceptable value; this option does not
498498+ throw an error when `domain` is unset.
479499 '';
480500 };
481501