diff options
| author | 2026-09-24 15:28:24 +0000 | |
|---|---|---|
| committer | 2026-09-24 15:28:24 +0000 | |
| commit | b0c5452e3bb1e3bdbb27181e331fc959fa43f4fc (patch) | |
| tree | 985f8f3f9ff08519a30dd839e2f0853db1cfdb82 /openspec/changes/archive/2026-09-24-add-automatic-timezone/proposal.md | |
| parent | 8c6d9629a0b3b723ce2785d26a36c26b8c8d1ba9 (diff) | |
| download | desktop-flake-b0c5452e3bb1e3bdbb27181e331fc959fa43f4fc.tar.gz desktop-flake-b0c5452e3bb1e3bdbb27181e331fc959fa43f4fc.tar.bz2 desktop-flake-b0c5452e3bb1e3bdbb27181e331fc959fa43f4fc.zip | |
Detect NixOS host timezone automatically instead of defaulting to UTC
Enables services.automatic-timezoned so every host's clock/calendar
reflects its actual location with no manual timedatectl step or auth
prompt, since GNOME's own automatic-timezone toggle isn't wired to a
passwordless polkit rule on NixOS the way KDE's is.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'openspec/changes/archive/2026-09-24-add-automatic-timezone/proposal.md')
| -rw-r--r-- | openspec/changes/archive/2026-09-24-add-automatic-timezone/proposal.md | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/openspec/changes/archive/2026-09-24-add-automatic-timezone/proposal.md b/openspec/changes/archive/2026-09-24-add-automatic-timezone/proposal.md new file mode 100644 index 0000000..6c2c77c --- /dev/null +++ b/openspec/changes/archive/2026-09-24-add-automatic-timezone/proposal.md | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | ## Why | ||
| 2 | |||
| 3 | Every NixOS host built from this flake currently defaults to `Etc/UTC` (`modules/nixos/common.nix`) and nothing ever changes that, so a freshly booted or freshly relocated machine shows the wrong local time/date everywhere (GNOME's clock, calendar, screenshots, log timestamps) until someone manually runs `timedatectl set-timezone`. Tom wants the timezone detected automatically instead. | ||
| 4 | |||
| 5 | ## What Changes | ||
| 6 | |||
| 7 | - Enable `services.automatic-timezoned` unconditionally on every NixOS host, in `modules/nixos/common.nix`, alongside the other unconditional host-level services (GNOME, SSH, printing). This is the NixOS-native daemon for this purpose: it uses `geoclue2` (which it enables and configures itself) to determine location and `systemd-timedated` to actually apply the timezone, and it ships its own polkit rule so the update happens automatically with no interactive auth prompt. | ||
| 8 | - The existing `time.timeZone = lib.mkDefault "Etc/UTC";` in `modules/nixos/common.nix` is left as-is: `automatic-timezoned` overrides it internally (`time.timeZone = null;`, at normal priority) whenever it's enabled, so `Etc/UTC` only remains as the boot-time value until the daemon determines and applies the real one shortly after boot (network permitting). No host in this repo (checked `hosts/test-vm`, the only real host, and `hosts/template`) sets `time.timeZone` explicitly, so there's no conflict with the module's requirement that an explicit timezone be set with a priority lower than default. | ||
| 9 | - **Not** relying on GNOME's own Settings → Date & Time → "Automatic Time Zone" toggle: NixOS's `systemd` package ships `org.freedesktop.timedate1.set-timezone` requiring `auth_admin` by default, and unlike the KDE Plasma module (`nixos/modules/services/desktop-managers/plasma6.nix`), nixpkgs' GNOME module adds no polkit rule to relax that for GNOME's own timezone daemon. `automatic-timezoned` ships and enables exactly that rule for its own dedicated service user, so it works without depending on GNOME-side authorization plumbing that isn't wired up on NixOS today. See `design.md` for the alternatives considered here. | ||
| 10 | - **BREAKING**: none — additive only. A host that later needs a fixed non-`Etc/UTC` timezone can still set `time.timeZone` at a priority higher than default (`lib.mkForce` or a plain assignment) in its own `configuration.nix`; doing so alongside this change without adjusting priority would now raise the same explicit "you set a timezone with `automatic-timezoned` enabled" evaluation error the upstream module already raises by design, which is the intended, deliberate-override behavior — not a silent conflict. | ||
| 11 | |||
| 12 | ## Capabilities | ||
| 13 | |||
| 14 | ### New Capabilities | ||
| 15 | - `automatic-timezone`: every NixOS host built from this flake keeps its system timezone (and therefore the desktop's clock/calendar) in sync with the host's actual location automatically, without manual `timedatectl` intervention or an interactive authorization prompt. | ||
| 16 | |||
| 17 | ### Modified Capabilities | ||
| 18 | (none) | ||
| 19 | |||
| 20 | ## Impact | ||
| 21 | |||
| 22 | - **Affected code**: `modules/nixos/common.nix` (add `services.automatic-timezoned.enable = true;`). | ||
| 23 | - **Not affected**: `modules/home/*` (home-manager-only `homeConfigurations` have no NixOS-level timezone service and are unaffected — they already inherit whatever timezone the host OS provides), `hosts/*/configuration.nix` (no host currently overrides `time.timeZone`), `lib/unfree-allowlist.nix` (`automatic-timezoned` is GPL-3.0, free). | ||
| 24 | - **Dependencies**: nixpkgs' `automatic-timezoned` and `geoclue2` packages, both already present in the pinned `nixos-unstable` input; no new flake inputs. `geoclue2`'s default network-based location source (`api.beacondb.net`) requires outbound internet access, which this repo's firewall config (inbound-only restrictions) doesn't block. | ||
| 25 | - **Platforms**: NixOS hosts only (`modules/nixos/common.nix`), via any host built by `lib/mkNixos.nix`. No effect on `homeConfigurations` (`tom@linux`, `tom@darwin`). | ||
| 26 | - **Known limitation, out of scope**: GNOME's own "Automatic Time Zone" toggle in Settings → Date & Time is not wired to this mechanism and may still prompt for authentication if the user flips it manually; the actual timezone is kept correct by the independent `automatic-timezoned` service regardless of that toggle's state. No reverse-geocoding/location-display UI is added — this only keeps `time.timeZone` current. Timezone detection is network-dependent (Wi-Fi/IP-based geolocation via `geoclue2`); a host with no network at boot keeps whatever timezone was last applied (or `Etc/UTC` on first boot) until connectivity returns. | ||
