lol

filesystems: use non-interactive formatOptions by default

When autoFormat is enabled, in order to successfully create a filesystem,
certain filesystems require specific options to be passed to mkfs to prevent
it from asking questions. This commit sets default formatOptions to "-q"
for "jfs" and "reiserfs" filesystems for this purpose.

Resolves #29140.

+11 -4
+11 -4
nixos/modules/tasks/filesystems.nix
··· 115 115 116 116 }; 117 117 118 - config = { 118 + config = let 119 + defaultFormatOptions = 120 + # -F needed to allow bare block device without partitions 121 + if (builtins.substring 0 3 config.fsType) == "ext" then "-F" 122 + # -q needed for non-interactive operations 123 + else if config.fsType == "jfs" then "-q" 124 + # (same here) 125 + else if config.fsType == "reiserfs" then "-q" 126 + else null; 127 + in { 119 128 options = mkIf config.autoResize [ "x-nixos.autoresize" ]; 120 - 121 - # -F needed to allow bare block device without partitions 122 - formatOptions = mkIf ((builtins.substring 0 3 config.fsType) == "ext") (mkDefault "-F"); 129 + formatOptions = mkIf (defaultFormatOptions != null) (mkDefault defaultFormatOptions); 123 130 }; 124 131 125 132 };