disko-install: improve error message if disk is not passed

This commit is contained in:
Jörg Thalheim 2024-03-05 14:27:01 +01:00 committed by mergify[bot]
parent 0d11aa8d64
commit cf185d687f
2 changed files with 15 additions and 13 deletions

View file

@ -163,7 +163,7 @@ main() {
# shellcheck disable=SC2064 # shellcheck disable=SC2064
trap "cleanupMountPoint ${escapeMountPoint}" EXIT trap "cleanupMountPoint ${escapeMountPoint}" EXIT
IFS=$'\n' mapfile -t artifacts < <(nix-build "${libexec_dir}"/install-cli.nix \ outputs=$(nix-build "${libexec_dir}"/install-cli.nix \
"${nix_args[@]}" \ "${nix_args[@]}" \
--no-out-link \ --no-out-link \
--impure \ --impure \
@ -174,6 +174,8 @@ main() {
--arg diskMappings "$(serialiaseArrayToNix diskMappings)" \ --arg diskMappings "$(serialiaseArrayToNix diskMappings)" \
-A installToplevel \ -A installToplevel \
-A "$diskoAttr") -A "$diskoAttr")
IFS=$'\n' mapfile -t artifacts <<<"$outputs"
nixos_system=${artifacts[0]} nixos_system=${artifacts[0]}
disko_script=${artifacts[1]} disko_script=${artifacts[1]}

View file

@ -15,7 +15,7 @@ let
dev = if diskMappings ? ${name} then dev = if diskMappings ? ${name} then
diskMappings.${name} diskMappings.${name}
else else
throw "No device passed for disk '${name}'"; throw "No device passed for disk '${name}'. Pass `--disk ${name} /dev/name` via commandline";
in value // { in value // {
device = dev; device = dev;
content = value.content // { device = dev; }; content = value.content // { device = dev; };