#!/usr/bin/env bash

# Select system timezone declaratively for Nnomarchy NixOS.

STATE_FILE="/etc/nixos/state.json"

timezone=$(timedatectl list-timezones | gum filter --height 20 --header "Set timezone") || exit 1

sudo jq ".timezone = \"$timezone\"" "$STATE_FILE" > /tmp/state.json && sudo mv /tmp/state.json "$STATE_FILE"

echo "Timezone is now set to $timezone. Applying changes..."
sudo sys-update
