Fix use of associative disk array

This commit is contained in:
Manuel Thalmann 2024-07-06 22:25:23 +02:00
parent e99bd0a615
commit 847269450d

View file

@ -1,7 +1,7 @@
{ lib, config, ... }:
let
inherit (lib) types mkOption;
diskVarName = "myDisk";
disksVarName = "myDisk";
isSwap = partition: builtins.elem partition.type [fs.swap 19];
fs = {
@ -11,11 +11,6 @@
fat32 = "fat32";
};
diskSelector = ''
. ${./../../scripts/Common/Scripts/choose-disk.sh};
chooseDisk ${diskVarName} "Which disk do you wish to install the OS on?";
'';
mkDiskType = osDisk: types.submodule (
{ config, name, ... }: {
options = {
@ -70,7 +65,13 @@
config =
let
diskVar = ''''${${diskVarName}[${config.id}]}'';
diskVarName = "${disksVarName}[${config.id}]";
diskVar = ''''${${diskVarName}}'';
diskSelector = ''
. ${./../../scripts/Common/Scripts/choose-disk.sh};
chooseDisk ${diskVarName} "Which disk do you wish to install the OS on?";
'';
partitions = builtins.foldl'
(list: predicate: lib.lists.sortOn predicate list)
@ -174,7 +175,7 @@
${diskSelector}
''
else ''
local ${diskVarName}=${config.devicePath}
${diskVarName}=${config.devicePath}
${if osDisk then ''
. ${./../../scripts/Common/Scripts/is-truthy.sh}
if [ ! -b ${diskVar} ]; then