summary refs log tree commit diff
path: root/nixos/modules/tasks/filesystems.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-09-24 18:13:14 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-09-24 19:59:44 +0200
commit9d92bd7845a0fcf895a1e7c4ae95c908be673060 (patch)
treea5c0990def36969e3bc19d4aa9fc97f7dadcc846 /nixos/modules/tasks/filesystems.nix
parentf40c7ed1435d9507868337ae7509fe6d0392498b (diff)
downloadnixlib-9d92bd7845a0fcf895a1e7c4ae95c908be673060.tar
nixlib-9d92bd7845a0fcf895a1e7c4ae95c908be673060.tar.gz
nixlib-9d92bd7845a0fcf895a1e7c4ae95c908be673060.tar.bz2
nixlib-9d92bd7845a0fcf895a1e7c4ae95c908be673060.tar.lz
nixlib-9d92bd7845a0fcf895a1e7c4ae95c908be673060.tar.xz
nixlib-9d92bd7845a0fcf895a1e7c4ae95c908be673060.tar.zst
nixlib-9d92bd7845a0fcf895a1e7c4ae95c908be673060.zip
Add filesystem option to automatically grow to the maximum size
This is primarily for EC2 and other cloud environments, where the disk
may be bigger than the original image.
Diffstat (limited to 'nixos/modules/tasks/filesystems.nix')
-rw-r--r--nixos/modules/tasks/filesystems.nix16
1 files changed, 14 insertions, 2 deletions
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index ab64106f3533..9dd250f140ce 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -7,7 +7,7 @@ let
 
   fileSystems = attrValues config.fileSystems;
 
-  prioOption = prio: optionalString (prio !=null) " pri=${toString prio}";
+  prioOption = prio: optionalString (prio != null) " pri=${toString prio}";
 
   fileSystemOpts = { name, config, ... }: {
 
@@ -43,7 +43,7 @@ let
       options = mkOption {
         default = "defaults";
         example = "data=journal";
-        type = types.commas;
+        type = types.commas; # FIXME: should be a list
         description = "Options used to mount the file system.";
       };
 
@@ -58,6 +58,17 @@ let
         '';
       };
 
+      autoResize = mkOption {
+        default = false;
+        type = types.bool;
+        description = ''
+          If set, the filesystem is grown to its maximum size before
+          being mounted. (This is typically the size of the containing
+          partition.) This is currently only supported for ext2/3/4
+          filesystems that are mounted during early boot.
+        '';
+      };
+
       noCheck = mkOption {
         default = false;
         type = types.bool;
@@ -69,6 +80,7 @@ let
     config = {
       mountPoint = mkDefault name;
       device = mkIf (config.fsType == "tmpfs") (mkDefault config.fsType);
+      options = mkIf config.autoResize "x-nixos.autoresize";
     };
 
   };