Skip to content

Commit

Permalink
nixos/tzupdate: make enabled module actually be enabled
Browse files Browse the repository at this point in the history
Without this fix, when setting `services.tzupdate.enable = true`, the service would never run automatically.

Now, it's actually enabled in systemd and it actually gets executed.

Still, it could be improved with a timer as explained in NixOS#127984 (comment), but this makes it at least work out of the box when rebooting the system.
  • Loading branch information
yajo committed Jan 20, 2025
1 parent 2b692ef commit e659a78
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nixos/modules/services/misc/tzupdate.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ in {
# zone, which is better than silently overriding it.
time.timeZone = null;

# We provide a one-shot service which can be manually run. We could
# provide a service that runs on startup, but it's tricky to get
# a service to run after you have *internet* access.
# We provide a one-shot service that runs at startup once network
# interfaces are up, but we can’t ensure we actually have Internet access
# at that point. It can also be run manually with `systemctl start tzupdate`.
systemd.services.tzupdate = {
description = "tzupdate timezone update service";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
script = ''
Expand Down

0 comments on commit e659a78

Please sign in to comment.