From 991d45ed67d8b5ef1cd745bace2094a05ac612b3 Mon Sep 17 00:00:00 2001 From: Martin Wimpress Date: Tue, 15 Oct 2024 14:10:19 +0100 Subject: [PATCH] fix: hardcode server timezone to UTC --- nixos/_mixins/features/time/default.nix | 27 +++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/nixos/_mixins/features/time/default.nix b/nixos/_mixins/features/time/default.nix index 25d6765a2..6c42739e6 100644 --- a/nixos/_mixins/features/time/default.nix +++ b/nixos/_mixins/features/time/default.nix @@ -1,21 +1,36 @@ -_: { +{ + hostname, + lib, + ... +}: +let + isServer = hostname == "malak" || hostname == "revan"; + useGeoclue = !isServer; +in +{ location = { provider = "geoclue2"; }; services = { - automatic-timezoned.enable = true; + automatic-timezoned.enable = useGeoclue; geoclue2 = { enable = true; # https://github.com/NixOS/nixpkgs/issues/321121 - geoProviderUrl = "https://beacondb.net/v1/geolocate"; - submissionNick = "geoclue"; - submissionUrl = "https://beacondb.net/v2/geosubmit"; + geoProviderUrl = "https://api.positon.xyz/v1/geolocate?key=test"; + submissionUrl = "https://api.positon.xyz/v2/geosubmit?key=test"; + submitData = false; }; - localtimed.enable = true; + localtimed.enable = useGeoclue; }; + # Prevent "Failed to open /etc/geoclue/conf.d/:" errors + systemd.tmpfiles.rules = [ + "d /etc/geoclue/conf.d 0755 root root" + ]; + time = { hardwareClockInLocalTime = true; + timeZone = lib.mkIf isServer "UTC"; }; }