Merge pull request #194759 from hercules-ci/fqdn-or-hostname
nixos: Add `networking.fqdnOrHostName`
This commit is contained in:
commit
93a905ec4f
9 changed files with 36 additions and 33 deletions
|
@ -177,8 +177,7 @@ in
|
|||
|
||||
hostname = mkOption {
|
||||
description = lib.mdDoc "Kubernetes kubelet hostname override.";
|
||||
default = config.networking.hostName;
|
||||
defaultText = literalExpression "config.networking.hostName";
|
||||
defaultText = literalExpression "config.networking.fqdnOrHostName";
|
||||
type = str;
|
||||
};
|
||||
|
||||
|
@ -349,8 +348,8 @@ in
|
|||
|
||||
boot.kernelModules = ["br_netfilter" "overlay"];
|
||||
|
||||
services.kubernetes.kubelet.hostname = with config.networking;
|
||||
mkDefault (hostName + optionalString (domain != null) ".${domain}");
|
||||
services.kubernetes.kubelet.hostname =
|
||||
mkDefault config.networking.fqdnOrHostName;
|
||||
|
||||
services.kubernetes.pki.certs = with top.lib; {
|
||||
kubelet = mkCert {
|
||||
|
|
|
@ -4,8 +4,7 @@ with lib;
|
|||
|
||||
let
|
||||
|
||||
host = config.networking.hostName or "unknown"
|
||||
+ optionalString (config.networking.domain != null) ".${config.networking.domain}";
|
||||
host = config.networking.fqdnOrHostName;
|
||||
|
||||
cfg = config.services.smartd;
|
||||
opt = options.services.smartd;
|
||||
|
|
|
@ -92,10 +92,8 @@ in {
|
|||
Needed when running with Kubernetes as backend as this cannot be auto-detected";
|
||||
'';
|
||||
type = types.nullOr types.str;
|
||||
default = with config.networking; (hostName + optionalString (domain != null) ".${domain}");
|
||||
defaultText = literalExpression ''
|
||||
with config.networking; (hostName + optionalString (domain != null) ".''${domain}")
|
||||
'';
|
||||
default = config.networking.fqdnOrHostName;
|
||||
defaultText = literalExpression "config.networking.fqdnOrHostName";
|
||||
example = "node1.example.com";
|
||||
};
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ in
|
|||
config = {
|
||||
hostName = mkDefault name;
|
||||
mucNickname = mkDefault (builtins.replaceStrings [ "." ] [ "-" ] (
|
||||
config.networking.hostName + optionalString (config.networking.domain != null) ".${config.networking.domain}"
|
||||
config.networking.fqdnOrHostName
|
||||
));
|
||||
};
|
||||
}));
|
||||
|
|
|
@ -60,11 +60,8 @@ in {
|
|||
|
||||
hostname = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = if config.networking.domain != null then
|
||||
config.networking.fqdn
|
||||
else
|
||||
config.networking.hostName;
|
||||
defaultText = lib.literalExpression "config.networking.fqdn";
|
||||
default = config.networking.fqdnOrHostName;
|
||||
defaultText = lib.literalExpression "config.networking.fqdnOrHostName";
|
||||
example = "bookstack.example.com";
|
||||
description = lib.mdDoc ''
|
||||
The hostname to serve BookStack on.
|
||||
|
|
|
@ -42,11 +42,8 @@ in
|
|||
|
||||
hostname = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = if config.networking.domain != null then
|
||||
config.networking.fqdn
|
||||
else
|
||||
config.networking.hostName;
|
||||
defaultText = lib.literalExpression "config.networking.fqdn";
|
||||
default = config.networking.fqdnOrHostName;
|
||||
defaultText = lib.literalExpression "config.networking.fqdnOrHostName";
|
||||
example = "discourse.example.com";
|
||||
description = lib.mdDoc ''
|
||||
The hostname to serve Discourse on.
|
||||
|
|
|
@ -12,8 +12,6 @@ let
|
|||
phpExecutionUnit = "phpfpm-${pool}";
|
||||
databaseService = "mysql.service";
|
||||
|
||||
fqdn = if config.networking.domain != null then config.networking.fqdn else config.networking.hostName;
|
||||
|
||||
in {
|
||||
imports = [
|
||||
(mkRenamedOptionModule [ "services" "piwik" "enable" ] [ "services" "matomo" "enable" ])
|
||||
|
@ -77,11 +75,9 @@ in {
|
|||
|
||||
hostname = mkOption {
|
||||
type = types.str;
|
||||
default = "${user}.${fqdn}";
|
||||
default = "${user}.${config.networking.fqdnOrHostName}";
|
||||
defaultText = literalExpression ''
|
||||
if config.${options.networking.domain} != null
|
||||
then "${user}.''${config.${options.networking.fqdn}}"
|
||||
else "${user}.''${config.${options.networking.hostName}}"
|
||||
"${user}.''${config.${options.networking.fqdnOrHostName}}"
|
||||
'';
|
||||
example = "matomo.yourdomain.org";
|
||||
description = lib.mdDoc ''
|
||||
|
|
|
@ -54,11 +54,8 @@ in {
|
|||
|
||||
hostName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = if config.networking.domain != null then
|
||||
config.networking.fqdn
|
||||
else
|
||||
config.networking.hostName;
|
||||
defaultText = lib.literalExpression "config.networking.fqdn";
|
||||
default = config.networking.fqdnOrHostName;
|
||||
defaultText = lib.literalExpression "config.networking.fqdnOrHostName";
|
||||
example = "snipe-it.example.com";
|
||||
description = lib.mdDoc ''
|
||||
The hostname to serve Snipe-IT on.
|
||||
|
|
|
@ -473,9 +473,29 @@ in
|
|||
defaultText = literalExpression ''"''${networking.hostName}.''${networking.domain}"'';
|
||||
description = lib.mdDoc ''
|
||||
The fully qualified domain name (FQDN) of this host. It is the result
|
||||
of combining networking.hostName and networking.domain. Using this
|
||||
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 `networing.hostName` but prefer a fully qualified
|
||||
domain name may use `networking.fqdnOrHostName` instead.
|
||||
'';
|
||||
};
|
||||
|
||||
networking.fqdnOrHostName = mkOption {
|
||||
readOnly = true;
|
||||
type = types.str;
|
||||
default = if cfg.domain == null then cfg.hostName else cfg.fqdn;
|
||||
defaultText = literalExpression ''
|
||||
if cfg.domain == null then cfg.hostName else cfg.fqdn
|
||||
'';
|
||||
description = lib.mdDoc ''
|
||||
Either the fully qualified domain name (FQDN), or just the host name if
|
||||
it does not exists.
|
||||
|
||||
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.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue