mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 11:40:45 +00:00
Merge pull request #117371 from grahamc/sysctl-hostname
network-interfaces: set hostname from sysctl if defined
This commit is contained in:
commit
bc7c15825b
|
@ -1411,9 +1411,10 @@ in
|
|||
# Set the host and domain names in the activation script. Don't
|
||||
# clear it if it's not configured in the NixOS configuration,
|
||||
# since it may have been set by dhcpcd in the meantime.
|
||||
system.activationScripts.hostname =
|
||||
optionalString (cfg.hostName != "") ''
|
||||
hostname "${cfg.hostName}"
|
||||
system.activationScripts.hostname = let
|
||||
effectiveHostname = config.boot.kernel.sysctl."kernel.hostname" or cfg.hostName;
|
||||
in optionalString (effectiveHostname != "") ''
|
||||
hostname "${effectiveHostname}"
|
||||
'';
|
||||
system.activationScripts.domain =
|
||||
optionalString (cfg.domain != null) ''
|
||||
|
|
Loading…
Reference in a new issue