1
0
Fork 1
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:
Ryan Lahfa 2022-12-01 16:03:04 +01:00 committed by GitHub
commit bc7c15825b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) ''