Remove uses of the "merge" option attribute

It's redundant because you can (and should) specify an option type, or
an apply function.
wip/yesman
Eelco Dolstra 11 years ago
parent f4a418761b
commit d5047faede
  1. 3
      lib/options.nix
  2. 6
      lib/types.nix
  3. 2
      nixos/modules/config/nsswitch.nix
  4. 4
      nixos/modules/hardware/pcmcia.nix
  5. 2
      nixos/modules/misc/assertions.nix
  6. 3
      nixos/modules/security/apparmor.nix
  7. 3
      nixos/modules/services/audio/alsa.nix
  8. 6
      nixos/modules/services/hardware/udev.nix
  9. 6
      nixos/modules/services/logging/logstash.nix
  10. 2
      nixos/modules/services/misc/nix-daemon.nix
  11. 4
      nixos/modules/services/monitoring/smartd.nix
  12. 4
      nixos/modules/services/networking/networkmanager.nix
  13. 2
      nixos/modules/services/system/dbus.nix
  14. 2
      nixos/modules/services/x11/desktop-managers/default.nix
  15. 2
      nixos/modules/services/x11/window-managers/default.nix
  16. 2
      nixos/modules/system/activation/top-level.nix
  17. 2
      nixos/modules/system/boot/kernel.nix
  18. 3
      nixos/modules/system/boot/systemd-unit-options.nix
  19. 3
      nixos/modules/tasks/filesystems.nix
  20. 2
      nixos/modules/tasks/network-interfaces.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}.";

@ -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;

@ -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;

@ -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.
'';

@ -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

@ -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.
'';

@ -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!).

@ -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

@ -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;
};
};
};

@ -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.
'';

@ -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.";
};
};

@ -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;
};

@ -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 {

@ -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

@ -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

@ -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.
'';

@ -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;
};

@ -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.";
};

@ -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.";
};

@ -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

Loading…
Cancel
Save