diff options
author | Linus Heckemann <git@sphalerite.org> | 2023-10-28 10:17:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-28 10:17:15 +0200 |
commit | 86707945659e730bc7af48969d0898a765ee4c05 (patch) | |
tree | b41cdb205107c50ab64e1148d9383540dcf79f0e /nixos/modules/tasks | |
parent | 0643b928c86e6f8e1786ad2ffb666331a42add51 (diff) | |
parent | d300940637a74421b78d3e94b25daf35f1b9ec9d (diff) | |
download | nixpkgs-86707945659e730bc7af48969d0898a765ee4c05.tar nixpkgs-86707945659e730bc7af48969d0898a765ee4c05.tar.gz nixpkgs-86707945659e730bc7af48969d0898a765ee4c05.tar.bz2 nixpkgs-86707945659e730bc7af48969d0898a765ee4c05.tar.lz nixpkgs-86707945659e730bc7af48969d0898a765ee4c05.tar.xz nixpkgs-86707945659e730bc7af48969d0898a765ee4c05.tar.zst nixpkgs-86707945659e730bc7af48969d0898a765ee4c05.zip |
Merge pull request #263203 from nikstur/replace-activation
Replace simple activationScripts
Diffstat (limited to 'nixos/modules/tasks')
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 853a2cb3143..a0e8e5d47a6 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -1406,18 +1406,12 @@ in val = tempaddrValues.${opt}.sysctl; in nameValuePair "net.ipv6.conf.${replaceStrings ["."] ["/"] i.name}.use_tempaddr" val)); - # 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 = let - effectiveHostname = config.boot.kernel.sysctl."kernel.hostname" or cfg.hostName; - in optionalString (effectiveHostname != "") '' - hostname "${effectiveHostname}" - ''; - system.activationScripts.domain = - optionalString (cfg.domain != null) '' - domainname "${cfg.domain}" - ''; + systemd.services.domainname = lib.mkIf (cfg.domain != null) { + wantedBy = [ "sysinit.target" ]; + before = [ "sysinit.target" ]; + unitConfig.DefaultDependencies = false; + serviceConfig.ExecStart = ''domainname "${cfg.domain}"''; + }; environment.etc.hostid = mkIf (cfg.hostId != null) { source = hostidFile; }; boot.initrd.systemd.contents."/etc/hostid" = mkIf (cfg.hostId != null) { source = hostidFile; }; |