Make partition size nullable

This commit is contained in:
Manuel Thalmann 2024-06-22 18:21:25 +02:00
parent a233064815
commit dc4bcb4d22

View file

@ -131,7 +131,7 @@
order = mkOption { order = mkOption {
type = types.int; type = types.int;
description = "The sort order of the partition creation."; description = "The sort order of the partition creation.";
default = if (!isSwap) && ((builtins.match ".*[^[:space:]].*" config.size) == null) then 1 else 0; default = if (!isSwap) && ((builtins.match ".*[^[:space:]].*" (toString config.size)) == null) then 1 else 0;
}; };
label = mkOption { label = mkOption {
@ -147,8 +147,9 @@
}; };
size = mkOption { size = mkOption {
type = types.str; type = types.nullOr types.str;
description = "The size of the partition."; description = "The size of the partition.";
default = null;
}; };
sizeScript = mkOption { sizeScript = mkOption {
@ -170,7 +171,7 @@
then then
''echo "$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }' | awk '{ print int((($1 / 1024 / 1024) * 0.75) + 0.5)}')"G'' ''echo "$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }' | awk '{ print int((($1 / 1024 / 1024) * 0.75) + 0.5)}')"G''
else else
"echo ${lib.strings.escapeShellArg config.size}" "echo ${lib.strings.escapeShellArg (toString config.size)}"
); );
}; };
} }