Fix use of associative disk array
This commit is contained in:
parent
28cab3c0bc
commit
f21433b722
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue