From 775a3fd386fce3c5af4b87244a6c059dc087d5ca Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 7 Dec 2024 18:45:44 +0100 Subject: [PATCH] Allow partitions without format --- lib/modules/fileSystems/disks.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/modules/fileSystems/disks.nix b/lib/modules/fileSystems/disks.nix index 8ed5852f..c80bdfff 100644 --- a/lib/modules/fileSystems/disks.nix +++ b/lib/modules/fileSystems/disks.nix @@ -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 {