0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

nixos/networking: fix fqdnOrHostName when FQDN explictly set (#400864)

This commit is contained in:
Johannes Kirschbauer 2025-04-29 10:34:05 +02:00 committed by GitHub
commit c55b5f9b72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -604,17 +604,21 @@ in
networking.fqdnOrHostName = mkOption {
readOnly = true;
type = types.str;
default = if cfg.domain == null then cfg.hostName else cfg.fqdn;
default =
if (cfg.domain != null || opt.fqdn.highestPrio < (mkOptionDefault { }).priority) then
cfg.fqdn
else
cfg.hostName;
defaultText = literalExpression ''
if cfg.domain == null then cfg.hostName else cfg.fqdn
if config.networking.domain != null || config.networking.fqdn is set then config.networking.fqdn else config.networking.hostName
'';
description = ''
Either the fully qualified domain name (FQDN), or just the host name if
it does not exists.
it does not exist.
This is a convenience option for modules to read instead of `fqdn` when
a mere `hostName` is also an acceptable value; this option does not
throw an error when `domain` is unset.
throw an error when `domain` or `fqdn` is unset.
'';
};