From 3fc34aa9115281c14c80d09a77ad8985e256461a Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 09:30:02 +0300 Subject: [PATCH 1/3] tzupdate: use less with lib; make src rev accurate --- pkgs/applications/misc/tzupdate/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/misc/tzupdate/default.nix b/pkgs/applications/misc/tzupdate/default.nix index c991a71e9c0a..1d29d0948103 100644 --- a/pkgs/applications/misc/tzupdate/default.nix +++ b/pkgs/applications/misc/tzupdate/default.nix @@ -11,18 +11,18 @@ rustPlatform.buildRustPackage rec { src = fetchFromGitHub { owner = "cdown"; repo = "tzupdate"; - rev = version; + rev = "refs/tags/${version}"; hash = "sha256-eod4yFzX7pATNQmG7jU+r9mnC9nprJ55ufMXpKjw/YI="; }; cargoHash = "sha256-5+lp5xlwJxFDqzVxptJPX7z0iLoMkgdwHxvRVIXHF7Y="; - meta = with lib; { + meta = { description = "Set the system timezone based on IP geolocation"; homepage = "https://github.com/cdown/tzupdate"; - license = licenses.mit; - maintainers = with maintainers; [ camillemndn ]; - platforms = platforms.linux; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ camillemndn ]; + platforms = lib.platforms.linux; mainProgram = "tzupdate"; }; } From 94892f8f20c1312589ca59426a042642e563af45 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 09:30:19 +0300 Subject: [PATCH 2/3] tzupdate: add doronbehar to maintainers --- nixos/modules/services/misc/tzupdate.nix | 2 +- pkgs/applications/misc/tzupdate/default.nix | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/misc/tzupdate.nix b/nixos/modules/services/misc/tzupdate.nix index be63bb179e42..e9f086a2ad78 100644 --- a/nixos/modules/services/misc/tzupdate.nix +++ b/nixos/modules/services/misc/tzupdate.nix @@ -41,5 +41,5 @@ in { }; }; - meta.maintainers = [ ]; + meta.maintainers = with lib.maintainers; [ doronbehar ]; } diff --git a/pkgs/applications/misc/tzupdate/default.nix b/pkgs/applications/misc/tzupdate/default.nix index 1d29d0948103..adfb93fb0246 100644 --- a/pkgs/applications/misc/tzupdate/default.nix +++ b/pkgs/applications/misc/tzupdate/default.nix @@ -21,7 +21,10 @@ rustPlatform.buildRustPackage rec { description = "Set the system timezone based on IP geolocation"; homepage = "https://github.com/cdown/tzupdate"; license = lib.licenses.mit; - maintainers = with lib.maintainers; [ camillemndn ]; + maintainers = with lib.maintainers; [ + camillemndn + doronbehar + ]; platforms = lib.platforms.linux; mainProgram = "tzupdate"; }; From 8efaf0d2d6ae01cdafe9de714ab803d9eaec2aca Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Tue, 17 Sep 2024 09:30:55 +0300 Subject: [PATCH 3/3] nixos/tzupdate: use timedatectl to actually set the timezone See also: https://github.com/cdown/tzupdate/issues/135 --- nixos/modules/services/misc/tzupdate.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/misc/tzupdate.nix b/nixos/modules/services/misc/tzupdate.nix index e9f086a2ad78..9e979bb47675 100644 --- a/nixos/modules/services/misc/tzupdate.nix +++ b/nixos/modules/services/misc/tzupdate.nix @@ -30,13 +30,12 @@ in { description = "tzupdate timezone update service"; wants = [ "network-online.target" ]; after = [ "network-online.target" ]; + script = '' + timedatectl set-timezone $(${lib.getExe pkgs.tzupdate} --print-only) + ''; serviceConfig = { Type = "oneshot"; - # We could link directly into pkgs.tzdata, but at least timedatectl seems - # to expect the symlink to point directly to a file in etc. - # Setting the "debian timezone file" to point at /dev/null stops it doing anything. - ExecStart = "${pkgs.tzupdate}/bin/tzupdate -z /etc/zoneinfo -d /dev/null"; }; }; };