Fix use of associative disk array
This commit is contained in:
parent
28cab3c0bc
commit
f21433b722
1 changed files with 9 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib) types mkOption;
|
inherit (lib) types mkOption;
|
||||||
diskVarName = "myDisk";
|
disksVarName = "myDisk";
|
||||||
isSwap = partition: builtins.elem partition.type [fs.swap 19];
|
isSwap = partition: builtins.elem partition.type [fs.swap 19];
|
||||||
|
|
||||||
fs = {
|
fs = {
|
||||||
|
@ -11,11 +11,6 @@
|
||||||
fat32 = "fat32";
|
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 (
|
mkDiskType = osDisk: types.submodule (
|
||||||
{ config, name, ... }: {
|
{ config, name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
|
@ -70,7 +65,13 @@
|
||||||
|
|
||||||
config =
|
config =
|
||||||
let
|
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'
|
partitions = builtins.foldl'
|
||||||
(list: predicate: lib.lists.sortOn predicate list)
|
(list: predicate: lib.lists.sortOn predicate list)
|
||||||
|
@ -174,7 +175,7 @@
|
||||||
${diskSelector}
|
${diskSelector}
|
||||||
''
|
''
|
||||||
else ''
|
else ''
|
||||||
local ${diskVarName}=${config.devicePath}
|
${diskVarName}=${config.devicePath}
|
||||||
${if osDisk then ''
|
${if osDisk then ''
|
||||||
. ${./../../scripts/Common/Scripts/is-truthy.sh}
|
. ${./../../scripts/Common/Scripts/is-truthy.sh}
|
||||||
if [ ! -b ${diskVar} ]; then
|
if [ ! -b ${diskVar} ]; then
|
||||||
|
|
Loading…
Reference in a new issue