Allow partitions without format
This commit is contained in:
parent
510a38efa9
commit
775a3fd386
1 changed files with 7 additions and 5 deletions
|
@ -145,11 +145,12 @@ let
|
||||||
${fs.fat32} = label: "fatlabel ${partVar} ${label}";
|
${fs.fat32} = label: "fatlabel ${partVar} ${label}";
|
||||||
};
|
};
|
||||||
|
|
||||||
create = lib.strings.concatLines [
|
create = lib.strings.concatLines ([
|
||||||
(appendScript index ''${toString index}: "$(${sizeOption})" type=${mkType type}'')
|
(appendScript index ''${toString index}: "$(${sizeOption})" type=${mkType type}'')
|
||||||
probeScript
|
probeScript
|
||||||
|
] ++ (lib.optionals (format != null) [
|
||||||
"sudo ${formatScripts.${format}}"
|
"sudo ${formatScripts.${format}}"
|
||||||
];
|
]));
|
||||||
|
|
||||||
fallback = ''
|
fallback = ''
|
||||||
if ! { ls "${partVar}" 2>&1; } > /dev/null
|
if ! { ls "${partVar}" 2>&1; } > /dev/null
|
||||||
|
@ -162,8 +163,9 @@ let
|
||||||
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${deviceVar})"''
|
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${deviceVar})"''
|
||||||
''local ${partVarName}="$diskPath-part${toString index}"''
|
''local ${partVarName}="$diskPath-part${toString index}"''
|
||||||
(if keepExisting then fallback else create)
|
(if keepExisting then fallback else create)
|
||||||
|
] ++ (lib.optionals (format != null) [
|
||||||
"sudo ${labelScripts.${format} label}"
|
"sudo ${labelScripts.${format} label}"
|
||||||
]
|
])
|
||||||
)
|
)
|
||||||
partitions));
|
partitions));
|
||||||
|
|
||||||
|
@ -242,13 +244,13 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
format = mkOption {
|
format = mkOption {
|
||||||
type = types.enum (builtins.attrValues fs);
|
type = types.nullOr (types.enum (builtins.attrValues fs));
|
||||||
description = "The file system format of the partition.";
|
description = "The file system format of the partition.";
|
||||||
default =
|
default =
|
||||||
if (isSwap config) then
|
if (isSwap config) then
|
||||||
fs.swap
|
fs.swap
|
||||||
else
|
else
|
||||||
throw ("Partition format not specified.");
|
null;
|
||||||
};
|
};
|
||||||
|
|
||||||
size = mkOption {
|
size = mkOption {
|
||||||
|
|
Loading…
Reference in a new issue