summary refs log tree commit diff
diff options
context:
space:
mode:
authorlewo <lewo@abesis.fr>2019-03-22 14:35:57 +0100
committerGitHub <noreply@github.com>2019-03-22 14:35:57 +0100
commitc8a65c2d717c8b1e0c83ae38c7796847221d464d (patch)
treedf027b71172640d1f0d7c62cb2a9f38d4f94675e
parent11d204a9c4fa5b562b2588af9326d1ee2319481c (diff)
parent0eb6d0735f599fa84e99b727c93681bcae96c845 (diff)
downloadnixpkgs-c8a65c2d717c8b1e0c83ae38c7796847221d464d.tar
nixpkgs-c8a65c2d717c8b1e0c83ae38c7796847221d464d.tar.gz
nixpkgs-c8a65c2d717c8b1e0c83ae38c7796847221d464d.tar.bz2
nixpkgs-c8a65c2d717c8b1e0c83ae38c7796847221d464d.tar.lz
nixpkgs-c8a65c2d717c8b1e0c83ae38c7796847221d464d.tar.xz
nixpkgs-c8a65c2d717c8b1e0c83ae38c7796847221d464d.tar.zst
nixpkgs-c8a65c2d717c8b1e0c83ae38c7796847221d464d.zip
Merge pull request #57751 from talyz/master
filesystems: Add autoResize assertion
-rw-r--r--nixos/modules/tasks/filesystems.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index 07f8214cea2..43764bb82f1 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -209,10 +209,17 @@ in
 
     assertions = let
       ls = sep: concatMapStringsSep sep (x: x.mountPoint);
+      notAutoResizable = fs: fs.autoResize && !(hasPrefix "ext" fs.fsType || fs.fsType == "f2fs");
     in [
       { assertion = ! (fileSystems' ? "cycle");
         message = "The ‘fileSystems’ option can't be topologically sorted: mountpoint dependency path ${ls " -> " fileSystems'.cycle} loops to ${ls ", " fileSystems'.loops}";
       }
+      { assertion = ! (any notAutoResizable fileSystems);
+        message = let
+          fs = head (filter notAutoResizable fileSystems);
+        in
+          "Mountpoint '${fs.mountPoint}': 'autoResize = true' is not supported for 'fsType = \"${fs.fsType}\"':${if fs.fsType == "auto" then " fsType has to be explicitly set and" else ""} only the ext filesystems and f2fs support it.";
+      }
     ];
 
     # Export for use in other modules