Print a warning before formatting disks
This commit is contained in:
parent
6e9ff465dc
commit
4b42b9d849
|
@ -49,6 +49,12 @@
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
deviceVariable = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The name of the variable holding the name of the disk";
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
|
||||||
partitions = mkOption {
|
partitions = mkOption {
|
||||||
type = types.attrsOf (types.nullOr partitionType);
|
type = types.attrsOf (types.nullOr partitionType);
|
||||||
description = "The partitions of the disk.";
|
description = "The partitions of the disk.";
|
||||||
|
@ -169,6 +175,7 @@
|
||||||
partitions);
|
partitions);
|
||||||
in {
|
in {
|
||||||
id = if osDisk then "os" else "disk-${name}";
|
id = if osDisk then "os" else "disk-${name}";
|
||||||
|
deviceVariable = diskVar;
|
||||||
|
|
||||||
deviceScript = if osDisk && config.devicePath == null then ''
|
deviceScript = if osDisk && config.devicePath == null then ''
|
||||||
${diskSelector}
|
${diskSelector}
|
||||||
|
@ -348,6 +355,10 @@
|
||||||
(_: "sudo swapon ${partPath _}")
|
(_: "sudo swapon ${partPath _}")
|
||||||
(builtins.filter (_: _.useSwap) partitions));
|
(builtins.filter (_: _.useSwap) partitions));
|
||||||
in lib.strings.concatLines (
|
in lib.strings.concatLines (
|
||||||
|
(builtins.map (_: _.deviceScript) disks) ++ lib.optional ((builtins.length disks) > 0) (
|
||||||
|
''echo "Continuing this script will wipe the contents of '' + (
|
||||||
|
lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") disks)
|
||||||
|
) + (if (builtins.length disks) > 1 then " and " else "") + (lib.lists.last disks).deviceVariable) ++
|
||||||
(builtins.map (_: _.script) disks) ++ [
|
(builtins.map (_: _.script) disks) ++ [
|
||||||
mountScript
|
mountScript
|
||||||
swapScript
|
swapScript
|
||||||
|
|
Loading…
Reference in a new issue