Loading nixos/modules/services/misc/tzupdate.nix +31 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,25 @@ in update the timezone. ''; }; package = lib.mkPackageOption pkgs "tzupdate" { }; timer.enable = lib.mkOption { type = lib.types.bool; default = true; description = '' Enable the tzupdate timer to update the timezone automatically. ''; }; timer.interval = lib.mkOption { type = lib.types.str; default = "hourly"; description = '' The interval at which the tzupdate timer should run. See {manpage}`systemd.time(7)` to understand the format. ''; }; }; config = lib.mkIf cfg.enable { Loading @@ -35,7 +54,7 @@ in wants = [ "network-online.target" ]; after = [ "network-online.target" ]; script = '' timezone="$(${lib.getExe pkgs.tzupdate} --print-only)" timezone="$(${lib.getExe cfg.package} --print-only)" if [[ -n "$timezone" ]]; then echo "Setting timezone to '$timezone'" timedatectl set-timezone "$timezone" Loading @@ -46,6 +65,17 @@ in Type = "oneshot"; }; }; systemd.timers.tzupdate = { enable = cfg.timer.enable; interval = cfg.timer.interval; timerConfig = { OnStartupSec = "30s"; OnCalendar = cfg.timer.interval; Persistent = true; }; wantedBy = [ "timers.target" ]; }; }; meta.maintainers = with lib.maintainers; [ doronbehar ]; Loading Loading
nixos/modules/services/misc/tzupdate.nix +31 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,25 @@ in update the timezone. ''; }; package = lib.mkPackageOption pkgs "tzupdate" { }; timer.enable = lib.mkOption { type = lib.types.bool; default = true; description = '' Enable the tzupdate timer to update the timezone automatically. ''; }; timer.interval = lib.mkOption { type = lib.types.str; default = "hourly"; description = '' The interval at which the tzupdate timer should run. See {manpage}`systemd.time(7)` to understand the format. ''; }; }; config = lib.mkIf cfg.enable { Loading @@ -35,7 +54,7 @@ in wants = [ "network-online.target" ]; after = [ "network-online.target" ]; script = '' timezone="$(${lib.getExe pkgs.tzupdate} --print-only)" timezone="$(${lib.getExe cfg.package} --print-only)" if [[ -n "$timezone" ]]; then echo "Setting timezone to '$timezone'" timedatectl set-timezone "$timezone" Loading @@ -46,6 +65,17 @@ in Type = "oneshot"; }; }; systemd.timers.tzupdate = { enable = cfg.timer.enable; interval = cfg.timer.interval; timerConfig = { OnStartupSec = "30s"; OnCalendar = cfg.timer.interval; Persistent = true; }; wantedBy = [ "timers.target" ]; }; }; meta.maintainers = with lib.maintainers; [ doronbehar ]; Loading