From 718167630e3d15ac76f80b4f07f0a8febb2fb6eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Sat, 13 Dec 2025 13:55:04 +0800 Subject: [PATCH] nixos/automatic-timezoned: Fix boot delays and systemd unit ordering Since the service sets `WantedBy=default.target`, `graphical.target` ends up waiting for it to complete. Since `geoclue.service`, which *this* service depends on, in turn depends on `network-online.target`, this ends up making full boot wait for network availability. This is obviously unintended; The unit should have always had an `After=default.target`. Furthermore, the systemd docs recommend depending on specifically `multi-user.target` *or* `graphical.target`, rather than `default.target`. In practice, on a default NixOS system, using `default.target` delays starting this service until a graphical session starts - this is obviously not ideal, since it makes sense to update the timezone on a non-graphical system as well, so we fix that while we're at it. --- nixos/modules/services/system/automatic-timezoned.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/system/automatic-timezoned.nix b/nixos/modules/services/system/automatic-timezoned.nix index 8fc87fb93cd0..f6e347e2729f 100644 --- a/nixos/modules/services/system/automatic-timezoned.nix +++ b/nixos/modules/services/system/automatic-timezoned.nix @@ -57,13 +57,16 @@ in automatic-timezoned = { description = "Automatically update system timezone based on location"; requires = [ "automatic-timezoned-geoclue-agent.service" ]; - after = [ "automatic-timezoned-geoclue-agent.service" ]; + after = [ + "automatic-timezoned-geoclue-agent.service" + "multi-user.target" + ]; serviceConfig = { Type = "exec"; User = "automatic-timezoned"; ExecStart = "${cfg.package}/bin/automatic-timezoned"; }; - wantedBy = [ "default.target" ]; + wantedBy = [ "multi-user.target" ]; }; automatic-timezoned-geoclue-agent = { @@ -77,7 +80,6 @@ in Restart = "on-failure"; PrivateTmp = true; }; - wantedBy = [ "default.target" ]; }; };