Allow setting the keyboard layout from the config file
This commit is contained in:
parent
9962e8e147
commit
fb3a89f4b8
3 changed files with 16 additions and 8 deletions
|
@ -23,6 +23,12 @@
|
|||
description = "The console key map of the system.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
keyboardLayout = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The X11 keyboard layout of the system.";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
timeZone = "Europe/Zurich";
|
||||
keyMap = "de_CH-latin1";
|
||||
keyboardLayout = "ch";
|
||||
|
||||
i18n = {
|
||||
localeSettings =
|
||||
|
|
|
@ -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_X11_KEYMAP || set -l ARCH_X11_KEYMAP ch
|
||||
|
||||
set -l mountDir (getConfig valhalla.partition.rootDir)
|
||||
|
||||
|
@ -83,12 +82,14 @@ begin
|
|||
USER_GROUPS="$USER_GROUPS" \
|
||||
arch-chroot "$mountDir" bash "$tempDir/user.sh"
|
||||
|
||||
and set -l serviceName set-keymap.service
|
||||
and set -l serviceFile "$mountDir/etc/systemd/system/$serviceName"
|
||||
and cp "$dir/$serviceName" "$serviceFile"
|
||||
and systemd-nspawn -D "$mountDir" systemctl enable "$serviceName"
|
||||
and systemd-nspawn -bD "$mountDir" -E "ARCH_X11_KEYMAP=$ARCH_X11_KEYMAP"
|
||||
and systemd-nspawn -D "$mountDir" systemctl disable "$serviceName"
|
||||
and rm "$serviceFile"
|
||||
and if set -l keyLayout (getConfig valhalla.keyboardLayout)
|
||||
set -l serviceName set-keymap.service
|
||||
and set -l serviceFile "$mountDir/etc/systemd/system/$serviceName"
|
||||
and cp "$dir/$serviceName" "$serviceFile"
|
||||
and systemd-nspawn -D "$mountDir" systemctl enable "$serviceName"
|
||||
and systemd-nspawn -bD "$mountDir" -E "ARCH_X11_KEYMAP=$keyLayout"
|
||||
and systemd-nspawn -D "$mountDir" systemctl disable "$serviceName"
|
||||
and rm "$serviceFile"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue