From 9f8122dd2beb42f8eaf80f18b2da64e38c660873 Mon Sep 17 00:00:00 2001 From: Sandro Date: Thu, 11 Jun 2026 20:52:34 +0200 Subject: [PATCH] time: remove double condition --- modules/time/default.nix | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/modules/time/default.nix b/modules/time/default.nix index 01c4703..acdf418 100644 --- a/modules/time/default.nix +++ b/modules/time/default.nix @@ -3,19 +3,8 @@ with lib; let - cfg = config.time; - - timeZone = optionalString (cfg.timeZone != null) '' - if ! systemsetup -listtimezones | grep -q "^ ${cfg.timeZone}$"; then - echo "${cfg.timeZone} is not a valid timezone. The command 'listtimezones' will show a list of valid time zones." >&2 - false - fi - systemsetup -settimezone "${cfg.timeZone}" 2>/dev/null 1>&2 - ''; - in - { options = { @@ -37,8 +26,12 @@ in system.activationScripts.time.text = mkIf (cfg.timeZone != null) '' # Set defaults echo "configuring time..." >&2 - - ${timeZone} + + if ! systemsetup -listtimezones | grep -q "^ ${cfg.timeZone}$"; then + echo "${cfg.timeZone} is not a valid timezone. The command 'listtimezones' will show a list of valid time zones." >&2 + false + fi + systemsetup -settimezone "${cfg.timeZone}" 2>/dev/null 1>&2 ''; };