···92 Needed when running with Kubernetes as backend as this cannot be auto-detected";
93 '';
94 type = types.nullOr types.str;
95- default = with config.networking; (hostName + optionalString (domain != null) ".${domain}");
96- defaultText = literalExpression ''
97- with config.networking; (hostName + optionalString (domain != null) ".''${domain}")
98- '';
99 example = "node1.example.com";
100 };
101
···92 Needed when running with Kubernetes as backend as this cannot be auto-detected";
93 '';
94 type = types.nullOr types.str;
95+ default = config.networking.fqdnOrHostName;
96+ defaultText = literalExpression "config.networking.fqdnOrHostName";
0097 example = "node1.example.com";
98 };
99
···5455 hostName = lib.mkOption {
56 type = lib.types.str;
57- default = if config.networking.domain != null then
58- config.networking.fqdn
59- else
60- config.networking.hostName;
61- defaultText = lib.literalExpression "config.networking.fqdn";
62 example = "snipe-it.example.com";
63 description = lib.mdDoc ''
64 The hostname to serve Snipe-IT on.
···5455 hostName = lib.mkOption {
56 type = lib.types.str;
57+ default = config.networking.fqdnOrHostName;
58+ defaultText = lib.literalExpression "config.networking.fqdnOrHostName";
00059 example = "snipe-it.example.com";
60 description = lib.mdDoc ''
61 The hostname to serve Snipe-IT on.
+21-1
nixos/modules/tasks/network-interfaces.nix
···473 defaultText = literalExpression ''"''${networking.hostName}.''${networking.domain}"'';
474 description = lib.mdDoc ''
475 The fully qualified domain name (FQDN) of this host. It is the result
476- of combining networking.hostName and networking.domain. Using this
477 option will result in an evaluation error if the hostname is empty or
478 no domain is specified.
00000000000000000000479 '';
480 };
481
···473 defaultText = literalExpression ''"''${networking.hostName}.''${networking.domain}"'';
474 description = lib.mdDoc ''
475 The fully qualified domain name (FQDN) of this host. It is the result
476+ of combining `networking.hostName` and `networking.domain.` Using this
477 option will result in an evaluation error if the hostname is empty or
478 no domain is specified.
479+480+ Modules that accept a mere `networing.hostName` but prefer a fully qualified
481+ domain name may use `networking.fqdnOrHostName` instead.
482+ '';
483+ };
484+485+ networking.fqdnOrHostName = mkOption {
486+ readOnly = true;
487+ type = types.str;
488+ default = if cfg.domain == null then cfg.hostName else cfg.fqdn;
489+ defaultText = literalExpression ''
490+ if cfg.domain == null then cfg.hostName else cfg.fqdn
491+ '';
492+ description = lib.mdDoc ''
493+ Either the fully qualified domain name (FQDN), or just the host name if
494+ it does not exists.
495+496+ This is a convenience option for modules to read instead of `fqdn` when
497+ a mere `hostName` is also an acceptable value; this option does not
498+ throw an error when `domain` is unset.
499 '';
500 };
501