time: remove double condition

This commit is contained in:
Sandro 2026-06-11 20:52:34 +02:00 committed by GitHub
parent d0d0978f34
commit 9f8122dd2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
'';
};