summary refs log tree commit diff
path: root/nixos/modules/tasks/filesystems.nix
diff options
context:
space:
mode:
authorPavel Goran <me@pvgoran.name>2017-10-12 09:35:31 +0700
committerPavel Goran <me@pvgoran.name>2017-10-12 09:53:43 +0700
commite3f97e514d2c293145c99a2438bf31754dcccc06 (patch)
treee5af1360a6bc2ce1672fedc3a5cea52a19cfe2b5 /nixos/modules/tasks/filesystems.nix
parent056c764e84581fd54341a8e342198ebf8ae688a8 (diff)
downloadnixpkgs-e3f97e514d2c293145c99a2438bf31754dcccc06.tar
nixpkgs-e3f97e514d2c293145c99a2438bf31754dcccc06.tar.gz
nixpkgs-e3f97e514d2c293145c99a2438bf31754dcccc06.tar.bz2
nixpkgs-e3f97e514d2c293145c99a2438bf31754dcccc06.tar.lz
nixpkgs-e3f97e514d2c293145c99a2438bf31754dcccc06.tar.xz
nixpkgs-e3f97e514d2c293145c99a2438bf31754dcccc06.tar.zst
nixpkgs-e3f97e514d2c293145c99a2438bf31754dcccc06.zip
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.
Diffstat (limited to 'nixos/modules/tasks/filesystems.nix')
-rw-r--r--nixos/modules/tasks/filesystems.nix15
1 files changed, 11 insertions, 4 deletions
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index 6ceb36714b2..b3690fad1a6 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -115,11 +115,18 @@ let
 
     };
 
-    config = {
+    config = let
+      defaultFormatOptions =
+        # -F needed to allow bare block device without partitions
+        if (builtins.substring 0 3 config.fsType) == "ext" then "-F"
+        # -q needed for non-interactive operations
+        else if config.fsType == "jfs" then "-q"
+        # (same here)
+        else if config.fsType == "reiserfs" then "-q"
+        else null;
+    in {
       options = mkIf config.autoResize [ "x-nixos.autoresize" ];
-
-      # -F needed to allow bare block device without partitions
-      formatOptions = mkIf ((builtins.substring 0 3 config.fsType) == "ext") (mkDefault "-F");
+      formatOptions = mkIf (defaultFormatOptions != null) (mkDefault defaultFormatOptions);
     };
 
   };