Prefix valhalla related settings

This commit is contained in:
Manuel Thalmann 2024-07-11 19:31:50 +02:00
parent 2ca85d797b
commit 42c7d24198
9 changed files with 113 additions and 104 deletions

View file

@ -6,6 +6,7 @@
; ;
in { in {
options = { options = {
valhalla = {
i18n = { i18n = {
localeSettings = mkOption { localeSettings = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
@ -14,4 +15,5 @@
}; };
}; };
}; };
};
} }

View file

@ -286,6 +286,7 @@
); );
in { in {
options = { options = {
valhalla = {
partition = { partition = {
rootDir = mkOption { rootDir = mkOption {
type = types.str; type = types.str;
@ -311,16 +312,19 @@
}; };
}; };
}; };
};
config = { config = {
valhalla = {
partition = { partition = {
script = script =
let let
inherit (config.partition) os rootDir; cfg = config.valhalla.partition;
inherit (cfg) os rootDir;
inherit (lib.strings) normalizePath; inherit (lib.strings) normalizePath;
partPath = part: "/dev/disk/by-label/${part.label}"; partPath = part: "/dev/disk/by-label/${part.label}";
disks = ([os] ++ (builtins.attrValues config.partition.disks)); disks = ([os] ++ (builtins.attrValues cfg.disks));
partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks); partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks);
mountScript = lib.strings.concatLines ( mountScript = lib.strings.concatLines (
@ -362,4 +366,5 @@
); );
}; };
}; };
};
} }

View file

@ -4,7 +4,7 @@
]; ];
config = { config = {
partition.os.partitions = { valhalla.partition.os.partitions = {
# Keep Windows' boot partition # Keep Windows' boot partition
Boot.keepExisting = true; Boot.keepExisting = true;

View file

@ -4,7 +4,7 @@
]; ];
config = { config = {
partition.os.partitions = { valhalla.partition.os.partitions = {
OS.label = "Arch"; OS.label = "Arch";
}; };
}; };

View file

@ -8,6 +8,7 @@
]; ];
config = { config = {
valhalla = {
partition = { partition = {
os = { os = {
partitions = { partitions = {
@ -44,4 +45,5 @@
}; };
}; };
}; };
};
} }

View file

@ -4,6 +4,6 @@
]; ];
config = { config = {
partition.os.deviceName = "nvme0n1"; valhalla.partition.os.deviceName = "nvme0n1";
}; };
} }

View file

@ -6,7 +6,7 @@ begin
set -q CONFIG_MODULE || set -l CONFIG_MODULE "$dir/config.nix" set -q CONFIG_MODULE || set -l CONFIG_MODULE "$dir/config.nix"
set -q ARCH_TIMEZONE || set -l ARCH_TIMEZONE "Europe/Zurich" set -q ARCH_TIMEZONE || set -l ARCH_TIMEZONE "Europe/Zurich"
set -q ARCH_MOUNT_ROOT || set -l ARCH_MOUNT_ROOT (getConfig partition.rootDir --raw) set -q ARCH_MOUNT_ROOT || set -l ARCH_MOUNT_ROOT (getConfig valhalla.partition.rootDir --raw)
set -q ARCH_LANG || set -l ARCH_LANG en_US.UTF-8 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_KEYMAP || set -l ARCH_KEYMAP de_CH-latin1
set -q ARCH_X11_KEYMAP || set -l ARCH_X11_KEYMAP ch set -q ARCH_X11_KEYMAP || set -l ARCH_X11_KEYMAP ch
@ -49,7 +49,7 @@ begin
and arch-chroot "$ARCH_MOUNT_ROOT" hwclock --systohc and arch-chroot "$ARCH_MOUNT_ROOT" hwclock --systohc
and begin and begin
getConfig i18n.localeSettings --json | \ getConfig valhalla.i18n.localeSettings --json | \
jq --raw-output '[.[] | split(".") | .[0]] | unique | join("\\\\|")' jq --raw-output '[.[] | split(".") | .[0]] | unique | join("\\\\|")'
end | begin end | begin
read LOCALES read LOCALES
@ -57,7 +57,7 @@ begin
end end
and begin and begin
getConfig i18n.localeSettings --json | \ getConfig valhalla.i18n.localeSettings --json | \
jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")' jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")'
end | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/locale.conf > /dev/null end | arch-chroot "$ARCH_MOUNT_ROOT" tee /etc/locale.conf > /dev/null

View file

@ -5,7 +5,7 @@ pushd "${BASH_SOURCE%/*}" > /dev/null;
CONFIG_MODULE="${CONFIG_MODULE:-"./config.nix"}"; CONFIG_MODULE="${CONFIG_MODULE:-"./config.nix"}";
ARCH_TIMEZONE="${ARCH_TIMEZONE:-"Europe/Zurich"}"; ARCH_TIMEZONE="${ARCH_TIMEZONE:-"Europe/Zurich"}";
ARCH_HOSTNAME="${ARCH_HOSTNAME}"; ARCH_HOSTNAME="${ARCH_HOSTNAME}";
ARCH_MOUNT_ROOT="${ARCH_MOUNT_ROOT:-"$(../../eval-module.sh "$CONFIG_MODULE" partition.rootDir --raw)"}"; ARCH_MOUNT_ROOT="${ARCH_MOUNT_ROOT:-"$(../../eval-module.sh "$CONFIG_MODULE" valhalla.partition.rootDir --raw)"}";
ARCH_LANG="${ARCH_LANG:-"en_US.UTF-8"}"; ARCH_LANG="${ARCH_LANG:-"en_US.UTF-8"}";
ARCH_KEYMAP="${ARCH_KEYMAP:-"de_CH-latin1"}"; ARCH_KEYMAP="${ARCH_KEYMAP:-"de_CH-latin1"}";
ARCH_X11_KEYMAP="${ARCH_X11_KEYMAP:-"ch"}"; ARCH_X11_KEYMAP="${ARCH_X11_KEYMAP:-"ch"}";

View file

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
eval "$("${BASH_SOURCE%/*}/../../eval-module.sh" "$CONFIG_MODULE" partition.script --raw)"; eval "$("${BASH_SOURCE%/*}/../../eval-module.sh" "$CONFIG_MODULE" valhalla.partition.script --raw)";