diff --git a/lib/modules/partition.nix b/lib/modules/partition.nix index ef65a62c..3530b3f4 100644 --- a/lib/modules/partition.nix +++ b/lib/modules/partition.nix @@ -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