Unverified Commit bc7c1582 authored by Ryan Lahfa's avatar Ryan Lahfa Committed by GitHub
Browse files

Merge pull request #117371 from grahamc/sysctl-hostname

network-interfaces: set hostname from sysctl if defined
parents 2ae5aa0b 857c6490
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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) ''