Allow setting the key map

This commit is contained in:
Manuel Thalmann 2024-07-11 22:05:36 +02:00
parent 656de4bc62
commit 1f6fe9c181
3 changed files with 18 additions and 3 deletions

View file

@ -17,6 +17,12 @@
description = "The time zone of the system.";
default = null;
};
keyMap = mkOption {
type = types.nullOr types.str;
description = "The console key map of the system.";
default = null;
};
};
};
}

View file

@ -35,6 +35,7 @@
};
timeZone = "Europe/Zurich";
keyMap = "de_CH-latin1";
i18n = {
localeSettings =

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_KEYMAP || set -l ARCH_KEYMAP de_CH-latin1
set -q ARCH_X11_KEYMAP || set -l ARCH_X11_KEYMAP ch
set -l mountDir (getConfig valhalla.partition.rootDir)
@ -20,7 +19,11 @@ begin
set -l tempRoot "/opt/$(basename "$projectName")"
set -l tempDir "$tempRoot/$relativeDir"
loadkeys "$ARCH_KEYMAP"
if set -l keyMap (getConfig valhalla.keyMap)
loadkeys "$keyMap"
else
true
end
and if set -l timezone (getConfig valhalla.timeZone)
timedatectl set-timezone "$timezone"
@ -70,7 +73,12 @@ begin
jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")'
end | arch-chroot "$mountDir" tee /etc/locale.conf > /dev/null
and echo "KEYMAP=$ARCH_KEYMAP" | arch-chroot "$mountDir" tee /etc/vconsole.conf > /dev/null
and if set -q keyMap
echo "KEYMAP=$keyMap" | arch-chroot "$mountDir" tee /etc/vconsole.conf > /dev/null
else
true
end
and echo "$ARCH_HOSTNAME" | arch-chroot "$mountDir" tee /etc/hostname > /dev/null
and arch-chroot "$mountDir" mkinitcpio -P