mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/network-interfaces: replace hostname and domain activationScript
The hostname is already set by systemd https://www.freedesktop.org/software/systemd/man/latest/hostname.html#Hostname%20semantics Create a separate service that registers the domainname.
This commit is contained in:
parent
b5617e0575
commit
d300940637
1 changed files with 6 additions and 12 deletions
|
@ -1406,18 +1406,12 @@ in
|
||||||
val = tempaddrValues.${opt}.sysctl;
|
val = tempaddrValues.${opt}.sysctl;
|
||||||
in nameValuePair "net.ipv6.conf.${replaceStrings ["."] ["/"] i.name}.use_tempaddr" val));
|
in nameValuePair "net.ipv6.conf.${replaceStrings ["."] ["/"] i.name}.use_tempaddr" val));
|
||||||
|
|
||||||
# Set the host and domain names in the activation script. Don't
|
systemd.services.domainname = lib.mkIf (cfg.domain != null) {
|
||||||
# clear it if it's not configured in the NixOS configuration,
|
wantedBy = [ "sysinit.target" ];
|
||||||
# since it may have been set by dhcpcd in the meantime.
|
before = [ "sysinit.target" ];
|
||||||
system.activationScripts.hostname = let
|
unitConfig.DefaultDependencies = false;
|
||||||
effectiveHostname = config.boot.kernel.sysctl."kernel.hostname" or cfg.hostName;
|
serviceConfig.ExecStart = ''domainname "${cfg.domain}"'';
|
||||||
in optionalString (effectiveHostname != "") ''
|
};
|
||||||
hostname "${effectiveHostname}"
|
|
||||||
'';
|
|
||||||
system.activationScripts.domain =
|
|
||||||
optionalString (cfg.domain != null) ''
|
|
||||||
domainname "${cfg.domain}"
|
|
||||||
'';
|
|
||||||
|
|
||||||
environment.etc.hostid = mkIf (cfg.hostId != null) { source = hostidFile; };
|
environment.etc.hostid = mkIf (cfg.hostId != null) { source = hostidFile; };
|
||||||
boot.initrd.systemd.contents."/etc/hostid" = mkIf (cfg.hostId != null) { source = hostidFile; };
|
boot.initrd.systemd.contents."/etc/hostid" = mkIf (cfg.hostId != null) { source = hostidFile; };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue