Load language settings from the config
This commit is contained in:
parent
a9108dd12c
commit
73d72c569e
|
@ -47,6 +47,7 @@ irssi
|
|||
iw
|
||||
iwd
|
||||
jfsutils
|
||||
jq
|
||||
kitty-terminfo
|
||||
ldns
|
||||
less
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
#!/bin/env fish
|
||||
begin
|
||||
set -l dir (status dirname)
|
||||
. "$dir/../../Common/Scripts/config.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_MOUNT_ROOT || set -l ARCH_MOUNT_ROOT ("$dir/../../eval-module.sh" "$CONFIG_MODULE" partition.rootDir --raw)
|
||||
set -q ARCH_MOUNT_ROOT || set -l ARCH_MOUNT_ROOT (getConfig partition.rootDir --raw)
|
||||
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
|
||||
set -q LOCALE_PATTERN || set -l LOCALE_PATTERN "\(de_CH\|en_US\)"
|
||||
|
||||
set -q USER_NAME || set -l USER_NAME manuel
|
||||
set -q USER_DISPLAYNAME
|
||||
|
@ -52,13 +52,17 @@ begin
|
|||
and arch-chroot "$ARCH_MOUNT_ROOT" ln -sf "/usr/share/zoneinfo/$ARCH_TIMEZONE" /etc/localtime
|
||||
and arch-chroot "$ARCH_MOUNT_ROOT" hwclock --systohc
|
||||
|
||||
and arch-chroot "$ARCH_MOUNT_ROOT" sed -i "s/^#\?\($LOCALE_PATTERN.*\)\$/\1/" /etc/locale.gen
|
||||
and arch-chroot "$ARCH_MOUNT_ROOT" locale-gen
|
||||
and begin
|
||||
getConfig i18n.localeSettings --json | \
|
||||
jq --raw-output '[.[] | split(".") | .[0]] | unique | join("\\\\|")'
|
||||
end | begin
|
||||
read LOCALES
|
||||
and arch-chroot "$ARCH_MOUNT_ROOT" sed -i "s/^#\?\(\($LOCALES\).*\)\$/\1/" /etc/locale.gen
|
||||
end
|
||||
|
||||
and begin
|
||||
echo "LANG=de_CH.UTF-8"
|
||||
echo "LANGUAGE=en_US.UTF-8"
|
||||
echo "LC_MESSAGES=en_US.UTF-8"
|
||||
getConfig i18n.localeSettings --json | \
|
||||
jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")'
|
||||
end | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/locale.conf > /dev/null
|
||||
|
||||
and echo "KEYMAP=$ARCH_KEYMAP" | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/vconsole.conf > /dev/null
|
||||
|
|
5
scripts/Common/Scripts/config.fish
Normal file
5
scripts/Common/Scripts/config.fish
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/env fish
|
||||
function getConfig -S -a property
|
||||
. "$(status dirname)/eval-module.fish"
|
||||
evalModule "$CONFIG_MODULE" "$property" $argv[2..]
|
||||
end
|
5
scripts/Common/Scripts/eval-module.fish
Normal file
5
scripts/Common/Scripts/eval-module.fish
Normal file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/env fish
|
||||
function evalModule --argument-names modulePath property
|
||||
set -l nixPkgs 'import <nixpkgs> { config = {}; overlay = []; }'
|
||||
nix eval --file "$modulePath" --apply "_: (($nixPkgs).lib.evalModules { modules = [ _ ]; }).config.$property" $argv[3..]
|
||||
end
|
Loading…
Reference in a new issue