Prefix valhalla related settings
This commit is contained in:
parent
2ca85d797b
commit
42c7d24198
|
@ -6,11 +6,13 @@
|
||||||
;
|
;
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
i18n = {
|
valhalla = {
|
||||||
localeSettings = mkOption {
|
i18n = {
|
||||||
type = types.attrsOf types.str;
|
localeSettings = mkOption {
|
||||||
description = "The system wide locale settings";
|
type = types.attrsOf types.str;
|
||||||
default = {};
|
description = "The system wide locale settings";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -286,80 +286,85 @@
|
||||||
);
|
);
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
partition = {
|
valhalla = {
|
||||||
rootDir = mkOption {
|
partition = {
|
||||||
type = types.str;
|
rootDir = mkOption {
|
||||||
description = "The root of the installation directory to mount disks into.";
|
type = types.str;
|
||||||
default = "/mnt";
|
description = "The root of the installation directory to mount disks into.";
|
||||||
};
|
default = "/mnt";
|
||||||
|
};
|
||||||
|
|
||||||
os = mkOption {
|
os = mkOption {
|
||||||
type = mkDiskType true;
|
type = mkDiskType true;
|
||||||
description = "The partition layout of the OS disk.";
|
description = "The partition layout of the OS disk.";
|
||||||
};
|
};
|
||||||
|
|
||||||
disks = mkOption {
|
disks = mkOption {
|
||||||
type = types.attrsOf (mkDiskType false);
|
type = types.attrsOf (mkDiskType false);
|
||||||
description = "The additional disks to format.";
|
description = "The additional disks to format.";
|
||||||
default = {};
|
default = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
script = mkOption {
|
script = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
description = "The script for partitioning the system's disks.";
|
description = "The script for partitioning the system's disks.";
|
||||||
internal = true;
|
internal = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
partition = {
|
valhalla = {
|
||||||
script =
|
partition = {
|
||||||
let
|
script =
|
||||||
inherit (config.partition) os rootDir;
|
let
|
||||||
inherit (lib.strings) normalizePath;
|
cfg = config.valhalla.partition;
|
||||||
|
inherit (cfg) os rootDir;
|
||||||
|
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 (
|
||||||
builtins.map
|
builtins.map
|
||||||
(_: builtins.concatStringsSep " " [
|
(_: builtins.concatStringsSep " " [
|
||||||
"sudo"
|
"sudo"
|
||||||
"mount"
|
"mount"
|
||||||
"--mkdir"
|
"--mkdir"
|
||||||
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions))
|
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions))
|
||||||
(partPath _)
|
(partPath _)
|
||||||
(normalizePath "/${rootDir}/${_.mountPoint}")
|
(normalizePath "/${rootDir}/${_.mountPoint}")
|
||||||
])
|
])
|
||||||
(lib.lists.sortOn
|
(lib.lists.sortOn
|
||||||
(_: normalizePath "/${_.mountPoint}")
|
(_: normalizePath "/${_.mountPoint}")
|
||||||
(builtins.filter (_: _.mountPoint != null) partitions)));
|
(builtins.filter (_: _.mountPoint != null) partitions)));
|
||||||
|
|
||||||
swapScript = lib.strings.concatLines (
|
swapScript = lib.strings.concatLines (
|
||||||
builtins.map
|
builtins.map
|
||||||
(_: "sudo swapon ${partPath _}")
|
(_: "sudo swapon ${partPath _}")
|
||||||
(builtins.filter (_: _.useSwap) partitions));
|
(builtins.filter (_: _.useSwap) partitions));
|
||||||
in lib.strings.concatLines (
|
in lib.strings.concatLines (
|
||||||
(builtins.map (_: _.deviceScript) disks) ++ lib.optionals ((builtins.length disks) > 0) [
|
(builtins.map (_: _.deviceScript) disks) ++ lib.optionals ((builtins.length disks) > 0) [
|
||||||
". ${./../../../scripts/Common/Scripts/is-truthy.sh}"
|
". ${./../../../scripts/Common/Scripts/is-truthy.sh}"
|
||||||
''echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)"''
|
''echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)"''
|
||||||
(''echo "Continuing this script will wipe the contents of '' + (
|
(''echo "Continuing this script will wipe the contents of '' + (
|
||||||
lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") (lib.lists.init disks))
|
lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") (lib.lists.init disks))
|
||||||
) + (if (builtins.length disks) > 1 then " and " else "") + (lib.lists.last disks).deviceVariable + ''"'')
|
) + (if (builtins.length disks) > 1 then " and " else "") + (lib.lists.last disks).deviceVariable + ''"'')
|
||||||
''read -p "Are you sure you want to continue? [y/n] " answer''
|
''read -p "Are you sure you want to continue? [y/n] " answer''
|
||||||
''
|
''
|
||||||
if ! isTruthy "$answer"; then
|
if ! isTruthy "$answer"; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
''
|
''
|
||||||
] ++
|
] ++
|
||||||
(builtins.map (_: _.script) disks) ++ [
|
(builtins.map (_: _.script) disks) ++ [
|
||||||
mountScript
|
mountScript
|
||||||
swapScript
|
swapScript
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
partition.os.partitions = {
|
valhalla.partition.os.partitions = {
|
||||||
OS.label = "Arch";
|
OS.label = "Arch";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,40 +8,42 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
partition = {
|
valhalla = {
|
||||||
os = {
|
partition = {
|
||||||
partitions = {
|
os = {
|
||||||
Boot = {
|
partitions = {
|
||||||
index = 1;
|
Boot = {
|
||||||
type = "uefi";
|
index = 1;
|
||||||
size = "+1G";
|
type = "uefi";
|
||||||
format = fs.fat32;
|
size = "+1G";
|
||||||
mountPoint = "/boot";
|
format = fs.fat32;
|
||||||
};
|
mountPoint = "/boot";
|
||||||
|
};
|
||||||
|
|
||||||
Swap = {
|
Swap = {
|
||||||
index = 2;
|
index = 2;
|
||||||
type = "swap";
|
type = "swap";
|
||||||
};
|
};
|
||||||
|
|
||||||
OS = {
|
OS = {
|
||||||
index = 3;
|
index = 3;
|
||||||
type = "linux";
|
type = "linux";
|
||||||
format = fs.ext4;
|
format = fs.ext4;
|
||||||
mountPoint = "/";
|
mountPoint = "/";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
i18n = {
|
i18n = {
|
||||||
localeSettings =
|
localeSettings =
|
||||||
let defaultLocale = "en_US.UTF-8";
|
let defaultLocale = "en_US.UTF-8";
|
||||||
in {
|
in {
|
||||||
LANG = "de_CH.UTF-8";
|
LANG = "de_CH.UTF-8";
|
||||||
LANGUAGE = defaultLocale;
|
LANGUAGE = defaultLocale;
|
||||||
LC_MESSAGE = defaultLocale;
|
LC_MESSAGE = defaultLocale;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,6 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
partition.os.deviceName = "nvme0n1";
|
valhalla.partition.os.deviceName = "nvme0n1";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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"}";
|
||||||
|
|
|
@ -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)";
|
||||||
|
|
Loading…
Reference in a new issue