summary refs log tree commit diff
path: root/nixos/modules/tasks/filesystems.nix
diff options
context:
space:
mode:
authorAneesh Agrawal <aneeshusa@gmail.com>2015-10-21 17:37:14 +0000
committerRobin Gloster <mail@glob.in>2016-02-06 19:48:30 +0000
commit3c5fca9618241334f40bfd2199cdfabb4fad55ec (patch)
treecfcf6aae28bfcd93df11019c9486255ffb440e31 /nixos/modules/tasks/filesystems.nix
parentf7aa92177355dc94d7e554cb6b089eb81cb320fa (diff)
downloadnixlib-3c5fca9618241334f40bfd2199cdfabb4fad55ec.tar
nixlib-3c5fca9618241334f40bfd2199cdfabb4fad55ec.tar.gz
nixlib-3c5fca9618241334f40bfd2199cdfabb4fad55ec.tar.bz2
nixlib-3c5fca9618241334f40bfd2199cdfabb4fad55ec.tar.lz
nixlib-3c5fca9618241334f40bfd2199cdfabb4fad55ec.tar.xz
nixlib-3c5fca9618241334f40bfd2199cdfabb4fad55ec.tar.zst
nixlib-3c5fca9618241334f40bfd2199cdfabb4fad55ec.zip
filesystems: use list of strings for fs options
Allow usage of list of strings instead of a comma-separated string
for filesystem options. Deprecate the comma-separated string style
with a warning message; convert this to a hard error after 16.09.
15.09 was just released, so this provides a deprecation period during
the 16.03 release.

closes #10518

Signed-off-by: Robin Gloster <mail@glob.in>
Diffstat (limited to 'nixos/modules/tasks/filesystems.nix')
-rw-r--r--nixos/modules/tasks/filesystems.nix18
1 files changed, 11 insertions, 7 deletions
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index d0dd7670157e..4d1466db22d0 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -41,11 +41,15 @@ let
       };
 
       options = mkOption {
-        default = "defaults";
-        example = "data=journal";
-        type = types.commas; # FIXME: should be a list
+        default = [ "defaults" ];
+        example = [ "data=journal" ];
         description = "Options used to mount the file system.";
-      };
+      } // (if versionAtLeast lib.nixpkgsVersion "16.09" then {
+        type = types.listOf types.str;
+      } else {
+        type = types.either types.commas (types.listOf types.str);
+        apply = x: if isList x then x else lib.strings.splitString "," (builtins.trace "warning: passing a comma-separated string for filesystem options is deprecated; use a list of strings instead. This will become a hard error in 16.09." x);
+      });
 
       autoFormat = mkOption {
         default = false;
@@ -112,7 +116,7 @@ in
         "/data" = {
           device = "/dev/hda2";
           fsType = "ext3";
-          options = "data=journal";
+          options = [ "data=journal" ];
         };
         "/bigdisk".label = "bigdisk";
       };
@@ -127,7 +131,7 @@ in
         <command>mount</command>; defaults to
         <literal>"auto"</literal>), and <literal>options</literal>
         (the mount options passed to <command>mount</command> using the
-        <option>-o</option> flag; defaults to <literal>"defaults"</literal>).
+        <option>-o</option> flag; defaults to <literal>[ "defaults" ]</literal>).
 
         Instead of specifying <literal>device</literal>, you can also
         specify a volume label (<literal>label</literal>) for file
@@ -177,7 +181,7 @@ in
              else throw "No device specified for mount point ‘${fs.mountPoint}’.")
             + " " + fs.mountPoint
             + " " + fs.fsType
-            + " " + fs.options
+            + " " + builtins.concatStringsSep "," fs.options
             + " 0"
             + " " + (if skipCheck fs then "0" else
                      if fs.mountPoint == "/" then "1" else "2")