summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/options.nix3
-rw-r--r--lib/types.nix6
-rw-r--r--nixos/modules/config/nsswitch.nix2
-rw-r--r--nixos/modules/hardware/pcmcia.nix4
-rw-r--r--nixos/modules/misc/assertions.nix2
-rw-r--r--nixos/modules/security/apparmor.nix3
-rw-r--r--nixos/modules/services/audio/alsa.nix3
-rw-r--r--nixos/modules/services/hardware/udev.nix6
-rw-r--r--nixos/modules/services/logging/logstash.nix6
-rw-r--r--nixos/modules/services/misc/nix-daemon.nix2
-rw-r--r--nixos/modules/services/monitoring/smartd.nix4
-rw-r--r--nixos/modules/services/networking/networkmanager.nix4
-rw-r--r--nixos/modules/services/system/dbus.nix2
-rw-r--r--nixos/modules/services/x11/desktop-managers/default.nix2
-rw-r--r--nixos/modules/services/x11/window-managers/default.nix2
-rw-r--r--nixos/modules/system/activation/top-level.nix2
-rw-r--r--nixos/modules/system/boot/kernel.nix2
-rw-r--r--nixos/modules/system/boot/systemd-unit-options.nix3
-rw-r--r--nixos/modules/tasks/filesystems.nix3
-rw-r--r--nixos/modules/tasks/network-interfaces.nix2
20 files changed, 36 insertions, 27 deletions
diff --git a/lib/options.nix b/lib/options.nix
index 480837fd1cf..d649d1160a0 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -66,6 +66,9 @@ rec {
          then head list
     else throw "Cannot merge values.";
 
+
+  /* Obsolete, will remove soon.  Specify an option type or apply
+     function instead.  */
   mergeTypedOption = typeName: predicate: merge: list:
     if all predicate list then merge list
     else throw "Expect a ${typeName}.";
diff --git a/lib/types.nix b/lib/types.nix
index 07a6cc69fdc..3c21e34879c 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -71,6 +71,12 @@ rec {
       merge = lib.concatStringsSep "\n";
     };
 
+    commas = mkOptionType {
+      name = "string";
+      check = builtins.isString;
+      merge = lib.concatStringsSep ",";
+    };
+
     envVar = mkOptionType {
       name = "environment variable";
       inherit (string) check;
diff --git a/nixos/modules/config/nsswitch.nix b/nixos/modules/config/nsswitch.nix
index ad62b5597be..2e2125d44f7 100644
--- a/nixos/modules/config/nsswitch.nix
+++ b/nixos/modules/config/nsswitch.nix
@@ -16,6 +16,7 @@ in
 
     # NSS modules.  Hacky!
     system.nssModules = mkOption {
+      type = types.listOf types.path;
       internal = true;
       default = [];
       description = ''
@@ -23,7 +24,6 @@ in
         several DNS resolution methods to be specified via
         <filename>/etc/nsswitch.conf</filename>.
       '';
-      merge = mergeListOption;
       apply = list:
         {
           inherit list;
diff --git a/nixos/modules/hardware/pcmcia.nix b/nixos/modules/hardware/pcmcia.nix
index 0dba59734ca..dea04ac753c 100644
--- a/nixos/modules/hardware/pcmcia.nix
+++ b/nixos/modules/hardware/pcmcia.nix
@@ -18,16 +18,16 @@ in
 
     hardware.pcmcia = {
       enable = mkOption {
+        type = types.bool;
         default = false;
-        merge = mergeEnableOption;
         description = ''
           Enable this option to support PCMCIA card.
         '';
       };
 
       firmware = mkOption {
+        type = types.listOf types.path;
         default = [];
-        merge = mergeListOption;
         description = ''
           List of firmware used to handle specific PCMCIA card.
         '';
diff --git a/nixos/modules/misc/assertions.nix b/nixos/modules/misc/assertions.nix
index 229f8f27860..5fb88308b77 100644
--- a/nixos/modules/misc/assertions.nix
+++ b/nixos/modules/misc/assertions.nix
@@ -15,10 +15,10 @@ in
   options = {
 
     assertions = mkOption {
+      type = types.listOf types.unspecified;
       internal = true;
       default = [];
       example = [ { assertion = false; message = "you can't enable this for that reason"; } ];
-      merge = pkgs.lib.mergeListOption;
       description = ''
         This option allows modules to express conditions that must
         hold for the evaluation of the system configuration to
diff --git a/nixos/modules/security/apparmor.nix b/nixos/modules/security/apparmor.nix
index d4aa0598dd3..b9f15159002 100644
--- a/nixos/modules/security/apparmor.nix
+++ b/nixos/modules/security/apparmor.nix
@@ -15,6 +15,7 @@ with pkgs.lib;
     security.apparmor = {
 
       enable = mkOption {
+        type = types.bool;
         default = false;
         description = ''
           Enable AppArmor application security system. Enable only if
@@ -23,8 +24,8 @@ with pkgs.lib;
       };
 
       profiles = mkOption {
+        type = types.listOf types.path;
         default = [];
-        merge = mergeListOption;
         description = ''
           List of file names of AppArmor profiles.
         '';
diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix
index 6c53ef46ab9..d021b8bd3ba 100644
--- a/nixos/modules/services/audio/alsa.nix
+++ b/nixos/modules/services/audio/alsa.nix
@@ -20,14 +20,15 @@ in
     sound = {
 
       enable = mkOption {
+        type = types.bool;
         default = true;
         description = ''
           Whether to enable ALSA sound.
         '';
-        merge = mergeEnableOption;
       };
 
       enableOSSEmulation = mkOption {
+        type = types.bool;
         default = true;
         description = ''
           Whether to enable ALSA OSS emulation (with certain cards sound mixing may not work!).
diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix
index 37dba8ce71d..75f01fbc5a9 100644
--- a/nixos/modules/services/hardware/udev.nix
+++ b/nixos/modules/services/hardware/udev.nix
@@ -126,8 +126,8 @@ in
     services.udev = {
 
       packages = mkOption {
+        type = types.listOf types.path;
         default = [];
-        merge = mergeListOption;
         description = ''
           List of packages containing <command>udev</command> rules.
           All files found in
@@ -138,8 +138,8 @@ in
       };
 
       path = mkOption {
+        type = types.listOf types.path;
         default = [];
-        merge = mergeListOption;
         description = ''
           Packages added to the <envar>PATH</envar> environment variable when
           executing programs from Udev rules.
@@ -162,9 +162,9 @@ in
     };
 
     hardware.firmware = mkOption {
+      type = types.listOf types.path;
       default = [];
       example = [ "/root/my-firmware" ];
-      merge = mergeListOption;
       description = ''
         List of directories containing firmware files.  Such files
         will be loaded automatically if the kernel asks for them
diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix
index 2f0eea50526..79bdf4f7bbc 100644
--- a/nixos/modules/services/logging/logstash.nix
+++ b/nixos/modules/services/logging/logstash.nix
@@ -99,7 +99,7 @@ in
           mkHash functions, which take a string representation of a float and an
           attrset, respectively.
         '';
-        merge = mergeConfigs;
+        apply = mergeConfigs;
       };
 
       filterConfig = mkOption {
@@ -109,7 +109,7 @@ in
           representing a logstash configuration's filter section.
           See inputConfig description for details.
         '';
-        merge = mergeConfigs;
+        apply = mergeConfigs;
       };
 
       outputConfig = mkOption {
@@ -119,7 +119,7 @@ in
           representing a logstash configuration's output section.
           See inputConfig description for details.
         '';
-        merge = mergeConfigs;
+        apply = mergeConfigs;
       };
     };
   };
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix
index e98f63f6886..d78c7fe2822 100644
--- a/nixos/modules/services/misc/nix-daemon.nix
+++ b/nixos/modules/services/misc/nix-daemon.nix
@@ -56,8 +56,8 @@ in
   options = {
 
     environment.nix = mkOption {
+      type = types.path;
       default = pkgs.nix;
-      merge = mergeOneOption;
       description = ''
         This option specifies the Nix package instance to use throughout the system.
       '';
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix
index de07dc0dbaa..b0619a16175 100644
--- a/nixos/modules/services/monitoring/smartd.nix
+++ b/nixos/modules/services/monitoring/smartd.nix
@@ -20,8 +20,8 @@ let
         default = "";
         example = "-d sat";
         type = types.string;
-        merge = pkgs.lib.concatStringsSep " ";
-        description = "Options that determine how smartd monitors the device";
+        apply = pkgs.lib.concatStringsSep " ";
+        description = "Options that determine how smartd monitors the device.";
       };
     };
 
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index 1d5682f5f3f..ad6f9858aaf 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -64,8 +64,8 @@ in {
     networking.networkmanager = {
 
       enable = mkOption {
+        type = types.bool;
         default = false;
-        merge = mergeEnableOption;
         description = ''
           Whether to use NetworkManager to obtain an IP address and other
           configuration for all network interfaces that are not manually
@@ -76,11 +76,11 @@ in {
       };
   
       packages = mkOption {
+        type = types.listOf types.path;
         default = [ ];
         description = ''
           Extra packages that provide NetworkManager plugins.
         '';
-        merge = mergeListOption;
         apply = list: [ networkmanager modemmanager wpa_supplicant ] ++ list;
       };
 
diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix
index 196fa40c551..40d0853d19d 100644
--- a/nixos/modules/services/system/dbus.nix
+++ b/nixos/modules/services/system/dbus.nix
@@ -68,12 +68,12 @@ in
     services.dbus = {
 
       enable = mkOption {
+        type = types.bool;
         default = true;
         description = ''
           Whether to start the D-Bus message bus daemon, which is
           required by many other system services and applications.
         '';
-        merge = pkgs.lib.mergeEnableOption;
       };
 
       packages = mkOption {
diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix
index 0fea74d5ba7..3578d702b28 100644
--- a/nixos/modules/services/x11/desktop-managers/default.nix
+++ b/nixos/modules/services/x11/desktop-managers/default.nix
@@ -50,10 +50,10 @@ in
       };
 
       default = mkOption {
+        type = types.uniq types.string;
         default = "";
         example = "none";
         description = "Default desktop manager loaded if none have been chosen.";
-        merge = mergeOneOption;
         apply = defaultDM:
           if defaultDM == "" && cfg.session.list != [] then
             (head cfg.session.list).name
diff --git a/nixos/modules/services/x11/window-managers/default.nix b/nixos/modules/services/x11/window-managers/default.nix
index c201b789ae4..e856a9e2079 100644
--- a/nixos/modules/services/x11/window-managers/default.nix
+++ b/nixos/modules/services/x11/window-managers/default.nix
@@ -40,10 +40,10 @@ in
       };
 
       default = mkOption {
+        type = types.uniq types.string;
         default = "none";
         example = "wmii";
         description = "Default window manager loaded if none have been chosen.";
-        merge = mergeOneOption;
         apply = defaultWM:
           if any (w: w.name == defaultWM) cfg.session then
             defaultWM
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index a04914bedaf..7b1c7d611d3 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -172,9 +172,9 @@ in
     };
 
     system.extraSystemBuilderCmds = mkOption {
+      type = types.lines;
       internal = true;
       default = "";
-      merge = concatStringsSep "\n";
       description = ''
         This code will be added to the builder creating the system store path.
       '';
diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix
index 0a3368ae416..4cea6279e50 100644
--- a/nixos/modules/system/boot/kernel.nix
+++ b/nixos/modules/system/boot/kernel.nix
@@ -117,6 +117,7 @@ in
     };
 
     system.modulesTree = mkOption {
+      type = types.listOf types.path;
       internal = true;
       default = [];
       description = ''
@@ -124,7 +125,6 @@ in
         built outside of the kernel.  Combine these into a single tree of
         symlinks because modprobe only supports one directory.
       '';
-      merge = mergeListOption;
       # Convert the list of path to only one path.
       apply = pkgs.aggregateModules;
     };
diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix
index 5c1fe34572c..d18c5d86417 100644
--- a/nixos/modules/system/boot/systemd-unit-options.nix
+++ b/nixos/modules/system/boot/systemd-unit-options.nix
@@ -319,8 +319,7 @@ rec {
     options = mkOption {
       default = "";
       example = "noatime";
-      type = types.string;
-      merge = concatStringsSep ",";
+      type = types.commas;
       description = "Options used to mount the file system.";
     };
 
diff --git a/nixos/modules/tasks/filesystems.nix b/nixos/modules/tasks/filesystems.nix
index 6e3d019ea93..2b4fe582c37 100644
--- a/nixos/modules/tasks/filesystems.nix
+++ b/nixos/modules/tasks/filesystems.nix
@@ -43,8 +43,7 @@ let
       options = mkOption {
         default = "defaults,relatime";
         example = "data=journal";
-        type = types.string;
-        merge = pkgs.lib.concatStringsSep ",";
+        type = types.commas;
         description = "Options used to mount the file system.";
       };
 
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 0177d6396df..0767c3db1fe 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -220,8 +220,8 @@ in
     };
 
     networking.useDHCP = mkOption {
+      type = types.bool;
       default = true;
-      merge = mergeEnableOption;
       description = ''
         Whether to use DHCP to obtain an IP address and other
         configuration for all network interfaces that are not manually