Allow partitions without format

This commit is contained in:
Manuel Thalmann 2024-12-07 18:45:44 +01:00
parent 510a38efa9
commit 775a3fd386

View file

@ -145,11 +145,12 @@ let
${fs.fat32} = label: "fatlabel ${partVar} ${label}";
};
create = lib.strings.concatLines [
create = lib.strings.concatLines ([
(appendScript index ''${toString index}: "$(${sizeOption})" type=${mkType type}'')
probeScript
] ++ (lib.optionals (format != null) [
"sudo ${formatScripts.${format}}"
];
]));
fallback = ''
if ! { ls "${partVar}" 2>&1; } > /dev/null
@ -162,8 +163,9 @@ let
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${deviceVar})"''
''local ${partVarName}="$diskPath-part${toString index}"''
(if keepExisting then fallback else create)
] ++ (lib.optionals (format != null) [
"sudo ${labelScripts.${format} label}"
]
])
)
partitions));
@ -242,13 +244,13 @@ let
};
format = mkOption {
type = types.enum (builtins.attrValues fs);
type = types.nullOr (types.enum (builtins.attrValues fs));
description = "The file system format of the partition.";
default =
if (isSwap config) then
fs.swap
else
throw ("Partition format not specified.");
null;
};
size = mkOption {