Allow specifying the timezone

This commit is contained in:
Manuel Thalmann 2024-07-11 21:58:46 +02:00
parent 4bd74ffb38
commit 6318a63307
3 changed files with 36 additions and 9 deletions

View file

@ -1,6 +1,22 @@
{ ... }: {
{ lib, ... }:
let
inherit (lib)
mkOption
types
;
in {
imports = [
./i18n.nix
./partition.nix
];
options = {
valhalla = {
timeZone = mkOption {
type = types.nullOr types.str;
description = "The time zone of the system.";
default = null;
};
};
};
}

View file

@ -34,6 +34,8 @@
};
};
timeZone = "Europe/Zurich";
i18n = {
localeSettings =
let defaultLocale = "en_US.UTF-8";

View file

@ -5,7 +5,6 @@ begin
source "$dir/../../Common/Scripts/hooks.fish"
set -q CONFIG_MODULE || set -l CONFIG_MODULE "$dir/config.nix"
set -q ARCH_TIMEZONE || set -l ARCH_TIMEZONE "Europe/Zurich"
set -q ARCH_LANG || set -l ARCH_LANG en_US.UTF-8
set -q ARCH_KEYMAP || set -l ARCH_KEYMAP de_CH-latin1
set -q ARCH_X11_KEYMAP || set -l ARCH_X11_KEYMAP ch
@ -23,7 +22,12 @@ begin
set -l tempDir "$tempRoot/$relativeDir"
loadkeys "$ARCH_KEYMAP"
and timedatectl set-timezone "$ARCH_TIMEZONE"
and if set -l timezone (getConfig valhalla.timeZone)
timedatectl set-timezone "$timezone"
else
true
end
and CONFIG_MODULE=$CONFIG_MODULE bash "$dir/../../Common/OS/partition.sh"
@ -46,7 +50,12 @@ begin
and arch-chroot "$mountDir" systemctl enable NetworkManager
and arch-chroot "$mountDir" ln -sf "/usr/share/zoneinfo/$ARCH_TIMEZONE" /etc/localtime
and if set -q timezone
arch-chroot "$mountDir" ln -sf "/usr/share/zoneinfo/$timezone" /etc/localtime
else
true
end
and arch-chroot "$mountDir" hwclock --systohc
and begin