Remove uses of the "merge" option attribute
It's redundant because you can (and should) specify an option type, or an apply function.
This commit is contained in:
parent
f4a418761b
commit
d5047faede
@ -66,6 +66,9 @@ rec {
|
|||||||
then head list
|
then head list
|
||||||
else throw "Cannot merge values.";
|
else throw "Cannot merge values.";
|
||||||
|
|
||||||
|
|
||||||
|
/* Obsolete, will remove soon. Specify an option type or apply
|
||||||
|
function instead. */
|
||||||
mergeTypedOption = typeName: predicate: merge: list:
|
mergeTypedOption = typeName: predicate: merge: list:
|
||||||
if all predicate list then merge list
|
if all predicate list then merge list
|
||||||
else throw "Expect a ${typeName}.";
|
else throw "Expect a ${typeName}.";
|
||||||
|
@ -71,6 +71,12 @@ rec {
|
|||||||
merge = lib.concatStringsSep "\n";
|
merge = lib.concatStringsSep "\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
commas = mkOptionType {
|
||||||
|
name = "string";
|
||||||
|
check = builtins.isString;
|
||||||
|
merge = lib.concatStringsSep ",";
|
||||||
|
};
|
||||||
|
|
||||||
envVar = mkOptionType {
|
envVar = mkOptionType {
|
||||||
name = "environment variable";
|
name = "environment variable";
|
||||||
inherit (string) check;
|
inherit (string) check;
|
||||||
|
@ -16,6 +16,7 @@ in
|
|||||||
|
|
||||||
# NSS modules. Hacky!
|
# NSS modules. Hacky!
|
||||||
system.nssModules = mkOption {
|
system.nssModules = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
internal = true;
|
internal = true;
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
@ -23,7 +24,6 @@ in
|
|||||||
several DNS resolution methods to be specified via
|
several DNS resolution methods to be specified via
|
||||||
<filename>/etc/nsswitch.conf</filename>.
|
<filename>/etc/nsswitch.conf</filename>.
|
||||||
'';
|
'';
|
||||||
merge = mergeListOption;
|
|
||||||
apply = list:
|
apply = list:
|
||||||
{
|
{
|
||||||
inherit list;
|
inherit list;
|
||||||
|
@ -18,16 +18,16 @@ in
|
|||||||
|
|
||||||
hardware.pcmcia = {
|
hardware.pcmcia = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
merge = mergeEnableOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
Enable this option to support PCMCIA card.
|
Enable this option to support PCMCIA card.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
firmware = mkOption {
|
firmware = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
default = [];
|
default = [];
|
||||||
merge = mergeListOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
List of firmware used to handle specific PCMCIA card.
|
List of firmware used to handle specific PCMCIA card.
|
||||||
'';
|
'';
|
||||||
|
@ -15,10 +15,10 @@ in
|
|||||||
options = {
|
options = {
|
||||||
|
|
||||||
assertions = mkOption {
|
assertions = mkOption {
|
||||||
|
type = types.listOf types.unspecified;
|
||||||
internal = true;
|
internal = true;
|
||||||
default = [];
|
default = [];
|
||||||
example = [ { assertion = false; message = "you can't enable this for that reason"; } ];
|
example = [ { assertion = false; message = "you can't enable this for that reason"; } ];
|
||||||
merge = pkgs.lib.mergeListOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
This option allows modules to express conditions that must
|
This option allows modules to express conditions that must
|
||||||
hold for the evaluation of the system configuration to
|
hold for the evaluation of the system configuration to
|
||||||
|
@ -15,6 +15,7 @@ with pkgs.lib;
|
|||||||
security.apparmor = {
|
security.apparmor = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Enable AppArmor application security system. Enable only if
|
Enable AppArmor application security system. Enable only if
|
||||||
@ -23,8 +24,8 @@ with pkgs.lib;
|
|||||||
};
|
};
|
||||||
|
|
||||||
profiles = mkOption {
|
profiles = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
default = [];
|
default = [];
|
||||||
merge = mergeListOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
List of file names of AppArmor profiles.
|
List of file names of AppArmor profiles.
|
||||||
'';
|
'';
|
||||||
|
@ -20,14 +20,15 @@ in
|
|||||||
sound = {
|
sound = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to enable ALSA sound.
|
Whether to enable ALSA sound.
|
||||||
'';
|
'';
|
||||||
merge = mergeEnableOption;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enableOSSEmulation = mkOption {
|
enableOSSEmulation = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to enable ALSA OSS emulation (with certain cards sound mixing may not work!).
|
Whether to enable ALSA OSS emulation (with certain cards sound mixing may not work!).
|
||||||
|
@ -126,8 +126,8 @@ in
|
|||||||
services.udev = {
|
services.udev = {
|
||||||
|
|
||||||
packages = mkOption {
|
packages = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
default = [];
|
default = [];
|
||||||
merge = mergeListOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
List of packages containing <command>udev</command> rules.
|
List of packages containing <command>udev</command> rules.
|
||||||
All files found in
|
All files found in
|
||||||
@ -138,8 +138,8 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
path = mkOption {
|
path = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
default = [];
|
default = [];
|
||||||
merge = mergeListOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
Packages added to the <envar>PATH</envar> environment variable when
|
Packages added to the <envar>PATH</envar> environment variable when
|
||||||
executing programs from Udev rules.
|
executing programs from Udev rules.
|
||||||
@ -162,9 +162,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
hardware.firmware = mkOption {
|
hardware.firmware = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
default = [];
|
default = [];
|
||||||
example = [ "/root/my-firmware" ];
|
example = [ "/root/my-firmware" ];
|
||||||
merge = mergeListOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
List of directories containing firmware files. Such files
|
List of directories containing firmware files. Such files
|
||||||
will be loaded automatically if the kernel asks for them
|
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
|
mkHash functions, which take a string representation of a float and an
|
||||||
attrset, respectively.
|
attrset, respectively.
|
||||||
'';
|
'';
|
||||||
merge = mergeConfigs;
|
apply = mergeConfigs;
|
||||||
};
|
};
|
||||||
|
|
||||||
filterConfig = mkOption {
|
filterConfig = mkOption {
|
||||||
@ -109,7 +109,7 @@ in
|
|||||||
representing a logstash configuration's filter section.
|
representing a logstash configuration's filter section.
|
||||||
See inputConfig description for details.
|
See inputConfig description for details.
|
||||||
'';
|
'';
|
||||||
merge = mergeConfigs;
|
apply = mergeConfigs;
|
||||||
};
|
};
|
||||||
|
|
||||||
outputConfig = mkOption {
|
outputConfig = mkOption {
|
||||||
@ -119,7 +119,7 @@ in
|
|||||||
representing a logstash configuration's output section.
|
representing a logstash configuration's output section.
|
||||||
See inputConfig description for details.
|
See inputConfig description for details.
|
||||||
'';
|
'';
|
||||||
merge = mergeConfigs;
|
apply = mergeConfigs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -56,8 +56,8 @@ in
|
|||||||
options = {
|
options = {
|
||||||
|
|
||||||
environment.nix = mkOption {
|
environment.nix = mkOption {
|
||||||
|
type = types.path;
|
||||||
default = pkgs.nix;
|
default = pkgs.nix;
|
||||||
merge = mergeOneOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
This option specifies the Nix package instance to use throughout the system.
|
This option specifies the Nix package instance to use throughout the system.
|
||||||
'';
|
'';
|
||||||
|
@ -20,8 +20,8 @@ let
|
|||||||
default = "";
|
default = "";
|
||||||
example = "-d sat";
|
example = "-d sat";
|
||||||
type = types.string;
|
type = types.string;
|
||||||
merge = pkgs.lib.concatStringsSep " ";
|
apply = pkgs.lib.concatStringsSep " ";
|
||||||
description = "Options that determine how smartd monitors the device";
|
description = "Options that determine how smartd monitors the device.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,8 +64,8 @@ in {
|
|||||||
networking.networkmanager = {
|
networking.networkmanager = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
merge = mergeEnableOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
Whether to use NetworkManager to obtain an IP address and other
|
Whether to use NetworkManager to obtain an IP address and other
|
||||||
configuration for all network interfaces that are not manually
|
configuration for all network interfaces that are not manually
|
||||||
@ -76,11 +76,11 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
packages = mkOption {
|
packages = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
Extra packages that provide NetworkManager plugins.
|
Extra packages that provide NetworkManager plugins.
|
||||||
'';
|
'';
|
||||||
merge = mergeListOption;
|
|
||||||
apply = list: [ networkmanager modemmanager wpa_supplicant ] ++ list;
|
apply = list: [ networkmanager modemmanager wpa_supplicant ] ++ list;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,12 +68,12 @@ in
|
|||||||
services.dbus = {
|
services.dbus = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to start the D-Bus message bus daemon, which is
|
Whether to start the D-Bus message bus daemon, which is
|
||||||
required by many other system services and applications.
|
required by many other system services and applications.
|
||||||
'';
|
'';
|
||||||
merge = pkgs.lib.mergeEnableOption;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = mkOption {
|
packages = mkOption {
|
||||||
|
@ -50,10 +50,10 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
default = mkOption {
|
default = mkOption {
|
||||||
|
type = types.uniq types.string;
|
||||||
default = "";
|
default = "";
|
||||||
example = "none";
|
example = "none";
|
||||||
description = "Default desktop manager loaded if none have been chosen.";
|
description = "Default desktop manager loaded if none have been chosen.";
|
||||||
merge = mergeOneOption;
|
|
||||||
apply = defaultDM:
|
apply = defaultDM:
|
||||||
if defaultDM == "" && cfg.session.list != [] then
|
if defaultDM == "" && cfg.session.list != [] then
|
||||||
(head cfg.session.list).name
|
(head cfg.session.list).name
|
||||||
|
@ -40,10 +40,10 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
default = mkOption {
|
default = mkOption {
|
||||||
|
type = types.uniq types.string;
|
||||||
default = "none";
|
default = "none";
|
||||||
example = "wmii";
|
example = "wmii";
|
||||||
description = "Default window manager loaded if none have been chosen.";
|
description = "Default window manager loaded if none have been chosen.";
|
||||||
merge = mergeOneOption;
|
|
||||||
apply = defaultWM:
|
apply = defaultWM:
|
||||||
if any (w: w.name == defaultWM) cfg.session then
|
if any (w: w.name == defaultWM) cfg.session then
|
||||||
defaultWM
|
defaultWM
|
||||||
|
@ -172,9 +172,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
system.extraSystemBuilderCmds = mkOption {
|
system.extraSystemBuilderCmds = mkOption {
|
||||||
|
type = types.lines;
|
||||||
internal = true;
|
internal = true;
|
||||||
default = "";
|
default = "";
|
||||||
merge = concatStringsSep "\n";
|
|
||||||
description = ''
|
description = ''
|
||||||
This code will be added to the builder creating the system store path.
|
This code will be added to the builder creating the system store path.
|
||||||
'';
|
'';
|
||||||
|
@ -117,6 +117,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
system.modulesTree = mkOption {
|
system.modulesTree = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
internal = true;
|
internal = true;
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
@ -124,7 +125,6 @@ in
|
|||||||
built outside of the kernel. Combine these into a single tree of
|
built outside of the kernel. Combine these into a single tree of
|
||||||
symlinks because modprobe only supports one directory.
|
symlinks because modprobe only supports one directory.
|
||||||
'';
|
'';
|
||||||
merge = mergeListOption;
|
|
||||||
# Convert the list of path to only one path.
|
# Convert the list of path to only one path.
|
||||||
apply = pkgs.aggregateModules;
|
apply = pkgs.aggregateModules;
|
||||||
};
|
};
|
||||||
|
@ -319,8 +319,7 @@ rec {
|
|||||||
options = mkOption {
|
options = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
example = "noatime";
|
example = "noatime";
|
||||||
type = types.string;
|
type = types.commas;
|
||||||
merge = concatStringsSep ",";
|
|
||||||
description = "Options used to mount the file system.";
|
description = "Options used to mount the file system.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,8 +43,7 @@ let
|
|||||||
options = mkOption {
|
options = mkOption {
|
||||||
default = "defaults,relatime";
|
default = "defaults,relatime";
|
||||||
example = "data=journal";
|
example = "data=journal";
|
||||||
type = types.string;
|
type = types.commas;
|
||||||
merge = pkgs.lib.concatStringsSep ",";
|
|
||||||
description = "Options used to mount the file system.";
|
description = "Options used to mount the file system.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
networking.useDHCP = mkOption {
|
networking.useDHCP = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
merge = mergeEnableOption;
|
|
||||||
description = ''
|
description = ''
|
||||||
Whether to use DHCP to obtain an IP address and other
|
Whether to use DHCP to obtain an IP address and other
|
||||||
configuration for all network interfaces that are not manually
|
configuration for all network interfaces that are not manually
|
||||||
|
Loading…
Reference in New Issue
Block a user