Timezones - How to setup on a laptop?

I have the timezone for my laptop as

time.timeZone = lib.mkDefault "Europe/London";

While this approach is fine for a desktop system which doesn’t move, what is the recommended approach for managing timezones for laptops which do cross timezone boundaries?

I am currently using kde, if that is significant!

Thanks!

I have yet to try it myself, but did you try out automatic-timezoned?

services.automatic-timezoned.enable = true;
1 Like

Thanks bjth - I haven’t tried that, but will do so, and feedback here.

1 Like

That seems to work, and I can now set the timezone manually from kde. I’m off to Singapore later, so it will be good to see how the automatic element works!

1 Like

I just tried this and got set to UTC. I also commented out time.timezone…

I was able to set the time zone manually through KDE, but this is not automatic. Is there anything else involved?

Mozilla have deprecated their geoclue implementation, but that is still the default for nixpkgs. You likely have some errors regarding this in your logs.

You’ll have to change the services.geoclue2.geoProviderUrl setting to point to a provider that isn’t defunct.

1 Like

Some providers are listed here: README.md · master · geoclue / geoclue · GitLab

1 Like

Perfect! Thanks for the pointers. Here is what I added to make this work:

  services.automatic-timezoned.enable = true;
  services.geoclue2.geoProviderUrl = "https://api.beacondb.net/v1/geolocate";

Also commented out the time.timeZone line.

I would recommend services.tzupdate.enable, its a oneshot (run with systemctl start tzupdate) and will update timezone when run, no tinkering or daemons used.

tzupdate uses a different method (geoip), which is generally less accurate than geoclue for various reasons. But yes, that’s another option.