mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-20 08:29:20 +03:00
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 {
|
hostname = mkOption {
|
||||||
description = lib.mdDoc "Kubernetes kubelet hostname override.";
|
description = lib.mdDoc "Kubernetes kubelet hostname override.";
|
||||||
default = config.networking.hostName;
|
defaultText = literalExpression "config.networking.fqdnOrHostName";
|
||||||
defaultText = literalExpression "config.networking.hostName";
|
|
||||||
type = str;
|
type = str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -349,8 +348,8 @@ in
|
||||||
|
|
||||||
boot.kernelModules = ["br_netfilter" "overlay"];
|
boot.kernelModules = ["br_netfilter" "overlay"];
|
||||||
|
|
||||||
services.kubernetes.kubelet.hostname = with config.networking;
|
services.kubernetes.kubelet.hostname =
|
||||||
mkDefault (hostName + optionalString (domain != null) ".${domain}");
|
mkDefault config.networking.fqdnOrHostName;
|
||||||
|
|
||||||
services.kubernetes.pki.certs = with top.lib; {
|
services.kubernetes.pki.certs = with top.lib; {
|
||||||
kubelet = mkCert {
|
kubelet = mkCert {
|
||||||
|
|
|
@ -4,8 +4,7 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
host = config.networking.hostName or "unknown"
|
host = config.networking.fqdnOrHostName;
|
||||||
+ optionalString (config.networking.domain != null) ".${config.networking.domain}";
|
|
||||||
|
|
||||||
cfg = config.services.smartd;
|
cfg = config.services.smartd;
|
||||||
opt = options.services.smartd;
|
opt = options.services.smartd;
|
||||||
|
|
|
@ -92,10 +92,8 @@ in {
|
||||||
Needed when running with Kubernetes as backend as this cannot be auto-detected";
|
Needed when running with Kubernetes as backend as this cannot be auto-detected";
|
||||||
'';
|
'';
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = with config.networking; (hostName + optionalString (domain != null) ".${domain}");
|
default = config.networking.fqdnOrHostName;
|
||||||
defaultText = literalExpression ''
|
defaultText = literalExpression "config.networking.fqdnOrHostName";
|
||||||
with config.networking; (hostName + optionalString (domain != null) ".''${domain}")
|
|
||||||
'';
|
|
||||||
example = "node1.example.com";
|
example = "node1.example.com";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ in
|
||||||
config = {
|
config = {
|
||||||
hostName = mkDefault name;
|
hostName = mkDefault name;
|
||||||
mucNickname = mkDefault (builtins.replaceStrings [ "." ] [ "-" ] (
|
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 {
|
hostname = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = if config.networking.domain != null then
|
default = config.networking.fqdnOrHostName;
|
||||||
config.networking.fqdn
|
defaultText = lib.literalExpression "config.networking.fqdnOrHostName";
|
||||||
else
|
|
||||||
config.networking.hostName;
|
|
||||||
defaultText = lib.literalExpression "config.networking.fqdn";
|
|
||||||
example = "bookstack.example.com";
|
example = "bookstack.example.com";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
The hostname to serve BookStack on.
|
The hostname to serve BookStack on.
|
||||||
|
|
|
@ -42,11 +42,8 @@ in
|
||||||
|
|
||||||
hostname = lib.mkOption {
|
hostname = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = if config.networking.domain != null then
|
default = config.networking.fqdnOrHostName;
|
||||||
config.networking.fqdn
|
defaultText = lib.literalExpression "config.networking.fqdnOrHostName";
|
||||||
else
|
|
||||||
config.networking.hostName;
|
|
||||||
defaultText = lib.literalExpression "config.networking.fqdn";
|
|
||||||
example = "discourse.example.com";
|
example = "discourse.example.com";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
The hostname to serve Discourse on.
|
The hostname to serve Discourse on.
|
||||||
|
|
|
@ -12,8 +12,6 @@ let
|
||||||
phpExecutionUnit = "phpfpm-${pool}";
|
phpExecutionUnit = "phpfpm-${pool}";
|
||||||
databaseService = "mysql.service";
|
databaseService = "mysql.service";
|
||||||
|
|
||||||
fqdn = if config.networking.domain != null then config.networking.fqdn else config.networking.hostName;
|
|
||||||
|
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
(mkRenamedOptionModule [ "services" "piwik" "enable" ] [ "services" "matomo" "enable" ])
|
(mkRenamedOptionModule [ "services" "piwik" "enable" ] [ "services" "matomo" "enable" ])
|
||||||
|
@ -77,11 +75,9 @@ in {
|
||||||
|
|
||||||
hostname = mkOption {
|
hostname = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "${user}.${fqdn}";
|
default = "${user}.${config.networking.fqdnOrHostName}";
|
||||||
defaultText = literalExpression ''
|
defaultText = literalExpression ''
|
||||||
if config.${options.networking.domain} != null
|
"${user}.''${config.${options.networking.fqdnOrHostName}}"
|
||||||
then "${user}.''${config.${options.networking.fqdn}}"
|
|
||||||
else "${user}.''${config.${options.networking.hostName}}"
|
|
||||||
'';
|
'';
|
||||||
example = "matomo.yourdomain.org";
|
example = "matomo.yourdomain.org";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
|
|
|
@ -54,11 +54,8 @@ in {
|
||||||
|
|
||||||
hostName = lib.mkOption {
|
hostName = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = if config.networking.domain != null then
|
default = config.networking.fqdnOrHostName;
|
||||||
config.networking.fqdn
|
defaultText = lib.literalExpression "config.networking.fqdnOrHostName";
|
||||||
else
|
|
||||||
config.networking.hostName;
|
|
||||||
defaultText = lib.literalExpression "config.networking.fqdn";
|
|
||||||
example = "snipe-it.example.com";
|
example = "snipe-it.example.com";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
The hostname to serve Snipe-IT on.
|
The hostname to serve Snipe-IT on.
|
||||||
|
|
|
@ -473,9 +473,29 @@ in
|
||||||
defaultText = literalExpression ''"''${networking.hostName}.''${networking.domain}"'';
|
defaultText = literalExpression ''"''${networking.hostName}.''${networking.domain}"'';
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
The fully qualified domain name (FQDN) of this host. It is the result
|
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
|
option will result in an evaluation error if the hostname is empty or
|
||||||
no domain is specified.
|
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…
Add table
Add a link
Reference in a new issue