From 408b8b5725c3e6fff75aef772da248d3e95ff414 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 30 Oct 2013 17:37:45 +0100 Subject: [PATCH] Add lots of missing option types --- nixos/modules/config/gnu.nix | 1 + nixos/modules/config/i18n.nix | 17 ++++++---- nixos/modules/config/networking.nix | 2 ++ nixos/modules/config/no-x-libs.nix | 8 +++-- nixos/modules/config/power-management.nix | 4 +++ nixos/modules/config/pulseaudio.nix | 12 ++++--- nixos/modules/config/users-groups.nix | 4 +-- nixos/modules/hardware/all-firmware.nix | 10 +++--- nixos/modules/hardware/pcmcia.nix | 2 +- nixos/modules/misc/check-config.nix | 8 +++-- nixos/modules/misc/crashdump.nix | 3 +- nixos/modules/misc/ids.nix | 2 ++ nixos/modules/misc/locate.nix | 5 +-- nixos/modules/misc/passthru.nix | 1 + nixos/modules/programs/shadow.nix | 2 +- nixos/modules/programs/ssh.nix | 8 +++-- nixos/modules/rename.nix | 1 + nixos/modules/security/pam.nix | 2 +- nixos/modules/security/pam_usb.nix | 1 + nixos/modules/security/polkit.nix | 3 ++ nixos/modules/security/rngd.nix | 1 + nixos/modules/security/rtkit.nix | 1 + nixos/modules/security/setuid-wrappers.nix | 5 +++ nixos/modules/security/sudo.nix | 3 ++ .../modules/services/databases/postgresql.nix | 17 +++++++--- nixos/modules/services/hardware/acpid.nix | 4 +++ nixos/modules/services/hardware/bluetooth.nix | 1 + nixos/modules/services/hardware/sane.nix | 27 ++++++++------- nixos/modules/services/hardware/udev.nix | 1 + nixos/modules/services/hardware/udisks.nix | 1 + nixos/modules/services/hardware/udisks2.nix | 1 + nixos/modules/services/hardware/upower.nix | 1 + nixos/modules/services/logging/syslogd.nix | 4 +-- nixos/modules/services/misc/nix-daemon.nix | 32 +++++++++++------- nixos/modules/services/misc/nixos-manual.nix | 4 ++- nixos/modules/services/misc/rogue.nix | 2 ++ .../modules/services/networking/firewall.nix | 6 ++++ nixos/modules/services/networking/nat.nix | 11 ++++--- nixos/modules/services/networking/rpcbind.nix | 1 + .../modules/services/networking/ssh/sshd.nix | 15 +++++++-- nixos/modules/services/printing/cupsd.nix | 11 +++++-- nixos/modules/services/scheduling/atd.nix | 11 ++++--- nixos/modules/services/scheduling/cron.nix | 22 ++++++++----- nixos/modules/services/scheduling/fcron.nix | 17 +++++++--- nixos/modules/services/system/dbus.nix | 1 + nixos/modules/services/system/nscd.nix | 1 + nixos/modules/services/ttys/agetty.nix | 2 ++ nixos/modules/services/ttys/gpm.nix | 2 ++ .../services/x11/desktop-managers/default.nix | 5 +-- .../services/x11/desktop-managers/kde4.nix | 4 +-- .../services/x11/desktop-managers/xfce.nix | 2 +- .../services/x11/display-managers/default.nix | 7 +++- .../services/x11/display-managers/kdm.nix | 9 +++-- .../services/x11/display-managers/slim.nix | 19 +++++++---- .../services/x11/window-managers/default.nix | 1 + nixos/modules/services/x11/xfs.nix | 13 +++++--- nixos/modules/services/x11/xserver.nix | 33 +++++++++++++++++-- nixos/modules/system/activation/top-level.nix | 4 +-- nixos/modules/system/boot/kernel.nix | 25 +++++--------- .../modules/system/boot/loader/grub/grub.nix | 2 +- nixos/modules/system/boot/modprobe.nix | 1 + nixos/modules/system/boot/stage-1.nix | 28 ++++++++-------- nixos/modules/system/boot/stage-2.nix | 6 ++-- nixos/modules/system/etc/etc.nix | 4 ++- nixos/modules/tasks/cpu-freq.nix | 6 ++-- nixos/tests/bittorrent.nix | 2 +- nixos/tests/nat.nix | 2 +- 67 files changed, 320 insertions(+), 154 deletions(-) diff --git a/nixos/modules/config/gnu.nix b/nixos/modules/config/gnu.nix index 1a69083a2069..6f5d2950463f 100644 --- a/nixos/modules/config/gnu.nix +++ b/nixos/modules/config/gnu.nix @@ -5,6 +5,7 @@ with pkgs.lib; { options = { gnu = mkOption { + type = types.bool; default = false; description = '' When enabled, GNU software is chosen by default whenever a there is diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 5570bb1adf6b..56d541cb9b3b 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -18,16 +18,18 @@ in i18n = { defaultLocale = mkOption { + type = types.str; default = "en_US.UTF-8"; example = "nl_NL.UTF-8"; - description = " + description = '' The default locale. It determines the language for program messages, the format for dates and times, sort order, and so on. It also determines the character set, such as UTF-8. - "; + ''; }; supportedLocales = mkOption { + type = types.listOf types.str; default = ["all"]; example = ["en_US.UTF-8/UTF-8" "nl_NL.UTF-8/UTF-8" "nl_NL/ISO-8859-1"]; description = '' @@ -40,22 +42,23 @@ in }; consoleFont = mkOption { + type = types.str; default = "lat9w-16"; example = "LatArCyrHeb-16"; - description = " + description = '' The font used for the virtual consoles. Leave empty to use whatever the setfont program considers the default font. - "; + ''; }; consoleKeyMap = mkOption { + type = types.str; default = "us"; example = "fr"; - description = " + description = '' The keyboard mapping table for the virtual consoles. - "; - type = types.str; + ''; }; }; diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix index f1bdfd01b24e..9ac68b428190 100644 --- a/nixos/modules/config/networking.nix +++ b/nixos/modules/config/networking.nix @@ -15,6 +15,7 @@ in options = { networking.extraHosts = pkgs.lib.mkOption { + type = types.lines; default = ""; example = "192.168.0.1 lanlocalhost"; description = '' @@ -23,6 +24,7 @@ in }; networking.dnsSingleRequest = pkgs.lib.mkOption { + type = types.bool; default = false; description = '' Recent versions of glibc will issue both ipv4 (A) and ipv6 (AAAA) diff --git a/nixos/modules/config/no-x-libs.nix b/nixos/modules/config/no-x-libs.nix index 77890b49c679..ec7bf3fea7b5 100644 --- a/nixos/modules/config/no-x-libs.nix +++ b/nixos/modules/config/no-x-libs.nix @@ -1,10 +1,12 @@ { config, pkgs, ... }: +with pkgs.lib; + { options = { - environment.noXlibs = pkgs.lib.mkOption { + environment.noXlibs = mkOption { + type = types.bool; default = false; - example = true; description = '' Switch off the options in the default configuration that require X libraries. Currently this includes: ssh X11 forwarding, dbus, fonts.enableCoreFonts, @@ -13,7 +15,7 @@ }; }; - config = pkgs.lib.mkIf config.environment.noXlibs { + config = mkIf config.environment.noXlibs { programs.ssh.setXAuthLocation = false; fonts = { enableCoreFonts = false; diff --git a/nixos/modules/config/power-management.nix b/nixos/modules/config/power-management.nix index fec2c886818a..7299136235ed 100644 --- a/nixos/modules/config/power-management.nix +++ b/nixos/modules/config/power-management.nix @@ -17,6 +17,7 @@ in powerManagement = { enable = mkOption { + type = types.bool; default = true; description = '' @@ -26,11 +27,13 @@ in }; resumeCommands = mkOption { + type = types.lines; default = ""; description = "Commands executed after the system resumes from suspend-to-RAM."; }; powerUpCommands = mkOption { + type = types.lines; default = ""; example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; description = @@ -42,6 +45,7 @@ in }; powerDownCommands = mkOption { + type = types.lines; default = ""; example = "${pkgs.hdparm}/sbin/hdparm -B 255 /dev/sda"; description = diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix index 26060f5b2d10..7a6cc542273a 100644 --- a/nixos/modules/config/pulseaudio.nix +++ b/nixos/modules/config/pulseaudio.nix @@ -46,6 +46,7 @@ in { hardware.pulseaudio = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the PulseAudio sound server. @@ -72,12 +73,13 @@ in { The path to the configuration the PulseAudio server should use. By default, the "default.pa" configuration from the PulseAudio distribution is used. - ''; + ''; }; - + package = mkOption { + type = types.path; default = pulseaudio; - example = "pulseaudio.override { jackaudioSupport = true; }"; + example = literalExample "pulseaudio.override { jackaudioSupport = true; }"; description = '' The PulseAudio derivation to use. This can be used to enable features (such as JACK support) that are not enabled in the @@ -125,9 +127,9 @@ in { description = "PulseAudio system service user"; home = pulseRuntimePath; }; - + users.extraGroups.pulse.gid = gid; - + systemd.services.pulseaudio = { description = "PulseAudio system-wide server"; wantedBy = [ "sound.target" ]; diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index 383f87120e08..d2eca7c3dcda 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -35,7 +35,7 @@ let }; extraGroups = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = "The user's auxiliary groups."; }; @@ -65,7 +65,7 @@ let }; password = mkOption { - type = with types; uniq (nullOr string); + type = with types; uniq (nullOr str); default = null; description = "The user's password. If undefined, no password is set for the user. Warning: do not set confidential information here because this data would be readable by all. This option should only be used for public account such as guest."; }; diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 16b6a862593a..027dd827b4dd 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -1,4 +1,6 @@ -{pkgs, config, ...}: +{ config, pkgs, ... }: + +with pkgs.lib; { @@ -6,9 +8,9 @@ options = { - hardware.enableAllFirmware = pkgs.lib.mkOption { + hardware.enableAllFirmware = mkOption { default = false; - type = pkgs.lib.types.bool; + type = types.bool; description = '' Turn on this option if you want to enable all the firmware shipped with Debian/Ubuntu. ''; @@ -19,7 +21,7 @@ ###### implementation - config = pkgs.lib.mkIf config.hardware.enableAllFirmware { + config = mkIf config.hardware.enableAllFirmware { hardware.firmware = [ "${pkgs.firmwareLinuxNonfree}/lib/firmware" ]; }; diff --git a/nixos/modules/hardware/pcmcia.nix b/nixos/modules/hardware/pcmcia.nix index dea04ac753c6..206846567505 100644 --- a/nixos/modules/hardware/pcmcia.nix +++ b/nixos/modules/hardware/pcmcia.nix @@ -36,7 +36,7 @@ in config = mkOption { default = null; description = '' - Path to the configuration file which map the memory, irq + Path to the configuration file which maps the memory, IRQs and ports used by the PCMCIA hardware. ''; }; diff --git a/nixos/modules/misc/check-config.nix b/nixos/modules/misc/check-config.nix index 28f36ad9ae55..f759c88d3a1f 100644 --- a/nixos/modules/misc/check-config.nix +++ b/nixos/modules/misc/check-config.nix @@ -1,10 +1,12 @@ -{pkgs, ...}: +{ pkgs, ... }: + +with pkgs.lib; { options = { - environment.checkConfigurationOptions = pkgs.lib.mkOption { + environment.checkConfigurationOptions = mkOption { + type = types.bool; default = true; - example = false; description = '' Whether to check the validity of the entire configuration. ''; diff --git a/nixos/modules/misc/crashdump.nix b/nixos/modules/misc/crashdump.nix index 6e6bc9dec0f3..6e71baa9a431 100644 --- a/nixos/modules/misc/crashdump.nix +++ b/nixos/modules/misc/crashdump.nix @@ -14,8 +14,8 @@ in boot = { crashDump = { enable = mkOption { + type = types.bool; default = false; - example = true; description = '' If enabled, NixOS will set up a kernel that will boot on crash, and leave the user to a stage1 debug1devices @@ -35,6 +35,7 @@ in ''; }; kernelParams = mkOption { + type = types.listOf types.str; default = [ "debug1devices" ]; description = '' Parameters that will be passed to the kernel kexec-ed on crash. diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index 9dc9b49b9e3b..e3edc9dda6b6 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -7,12 +7,14 @@ options = { ids.uids = pkgs.lib.mkOption { + internal = true; description = '' The user IDs used in NixOS. ''; }; ids.gids = pkgs.lib.mkOption { + internal = true; description = '' The group IDs used in NixOS. ''; diff --git a/nixos/modules/misc/locate.nix b/nixos/modules/misc/locate.nix index 02b1ed7b63d6..b6408be5844f 100644 --- a/nixos/modules/misc/locate.nix +++ b/nixos/modules/misc/locate.nix @@ -17,8 +17,8 @@ in services.locate = { enable = mkOption { + type = types.bool; default = false; - example = true; description = '' If enabled, NixOS will periodically update the database of files used by the locate command. @@ -26,11 +26,12 @@ in }; period = mkOption { + type = types.str; default = "15 02 * * *"; description = '' This option defines (in the format used by cron) when the locate database is updated. - The default is to update at 02:15 (at night) every day. + The default is to update at 02:15 at night every day. ''; }; diff --git a/nixos/modules/misc/passthru.nix b/nixos/modules/misc/passthru.nix index f68adc5e8430..b65f20d62f2d 100644 --- a/nixos/modules/misc/passthru.nix +++ b/nixos/modules/misc/passthru.nix @@ -6,6 +6,7 @@ { options = { passthru = pkgs.lib.mkOption { + visible = false; description = '' This attribute set will be exported as a system attribute. You can put whatever you want here. diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix index 36c915f755f0..9e46ab8b298f 100644 --- a/nixos/modules/programs/shadow.nix +++ b/nixos/modules/programs/shadow.nix @@ -48,7 +48,7 @@ in Rather, it should be the path of a symlink that points to the actual shell in the Nix store. ''; - type = types.uniq types.path; + type = types.path; }; }; diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix index 64bf25083163..a66679dff90d 100644 --- a/nixos/modules/programs/ssh.nix +++ b/nixos/modules/programs/ssh.nix @@ -16,6 +16,7 @@ in programs.ssh = { forwardX11 = mkOption { + type = types.bool; default = false; description = '' Whether to request X11 forwarding on outgoing connections by default. @@ -29,18 +30,21 @@ in }; setXAuthLocation = mkOption { + type = types.bool; default = true; description = '' Whether to set the path to xauth for X11-forwarded connections. - Pulls in X11 dependency. + This causes a dependency on X11 packages. ''; }; extraConfig = mkOption { + type = types.lines; default = ""; description = '' Extra configuration text appended to ssh_config. - See the ssh_config(5) man page for help. + See ssh_config5 + for help. ''; }; }; diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 0a8383870ee5..4f924b82a9df 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -93,6 +93,7 @@ in zipModules ([] ++ obsolete [ "boot" "grubSplashImage" ] [ "boot" "loader" "grub" "splashImage" ] ++ obsolete [ "boot" "initrd" "extraKernelModules" ] [ "boot" "initrd" "kernelModules" ] +++ obsolete [ "boot" "extraKernelParams" ] [ "boot" "kernelParams" ] # OpenSSH ++ obsolete [ "services" "sshd" "ports" ] [ "services" "openssh" "ports" ] diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix index 69a1972e9e75..93d12d292e4d 100644 --- a/nixos/modules/security/pam.nix +++ b/nixos/modules/security/pam.nix @@ -133,7 +133,7 @@ let }; text = mkOption { - type = types.nullOr types.string; + type = types.nullOr types.lines; description = "Contents of the PAM service file."; }; diff --git a/nixos/modules/security/pam_usb.nix b/nixos/modules/security/pam_usb.nix index 2bd3069ddb12..4cc99995fbca 100644 --- a/nixos/modules/security/pam_usb.nix +++ b/nixos/modules/security/pam_usb.nix @@ -17,6 +17,7 @@ in security.pam.usb = { enable = mkOption { + type = types.bool; default = false; description = '' Enable USB login for all login systems that support it. For diff --git a/nixos/modules/security/polkit.nix b/nixos/modules/security/polkit.nix index 8b04f4043bc7..cafa9f82d5e4 100644 --- a/nixos/modules/security/polkit.nix +++ b/nixos/modules/security/polkit.nix @@ -13,11 +13,13 @@ in options = { security.polkit.enable = mkOption { + type = types.bool; default = true; description = "Whether to enable PolKit."; }; security.polkit.permissions = mkOption { + type = types.lines; default = ""; example = '' @@ -49,6 +51,7 @@ in }; security.polkit.adminIdentities = mkOption { + type = types.str; default = "unix-user:0;unix-group:wheel"; example = ""; description = diff --git a/nixos/modules/security/rngd.nix b/nixos/modules/security/rngd.nix index dd251fe69d31..720ac02f2e81 100644 --- a/nixos/modules/security/rngd.nix +++ b/nixos/modules/security/rngd.nix @@ -5,6 +5,7 @@ with pkgs.lib; { options = { security.rngd.enable = mkOption { + type = types.bool; default = true; description = '' Whether to enable the rng daemon, which adds entropy from diff --git a/nixos/modules/security/rtkit.nix b/nixos/modules/security/rtkit.nix index e47e7baa2b84..164ad9b3aa7d 100644 --- a/nixos/modules/security/rtkit.nix +++ b/nixos/modules/security/rtkit.nix @@ -10,6 +10,7 @@ with pkgs.lib; options = { security.rtkit.enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the RealtimeKit system service, which hands diff --git a/nixos/modules/security/setuid-wrappers.nix b/nixos/modules/security/setuid-wrappers.nix index e75679e5ff69..62df85816e50 100644 --- a/nixos/modules/security/setuid-wrappers.nix +++ b/nixos/modules/security/setuid-wrappers.nix @@ -25,7 +25,9 @@ in options = { security.setuidPrograms = mkOption { + type = types.listOf types.str; default = []; + example = ["passwd"]; description = '' The Nix store cannot contain setuid/setgid programs directly. For this reason, NixOS can automatically generate wrapper @@ -36,6 +38,7 @@ in }; security.setuidOwners = mkOption { + type = types.listOf types.attrs; default = []; example = [ { program = "sendmail"; @@ -53,6 +56,8 @@ in }; security.wrapperDir = mkOption { + internal = true; + type = types.path; default = "/var/setuid-wrappers"; description = '' This option defines the path to the setuid wrappers. It diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix index 772517801981..215a8ecd6018 100644 --- a/nixos/modules/security/sudo.nix +++ b/nixos/modules/security/sudo.nix @@ -17,6 +17,7 @@ in options = { security.sudo.enable = mkOption { + type = types.bool; default = true; description = '' @@ -26,6 +27,7 @@ in }; security.sudo.wheelNeedsPassword = mkOption { + type = types.bool; default = true; description = '' @@ -35,6 +37,7 @@ in }; security.sudo.configFile = mkOption { + type = types.lines; # Note: if syntax errors are detected in this file, the NixOS # configuration will fail to build. description = diff --git a/nixos/modules/services/databases/postgresql.nix b/nixos/modules/services/databases/postgresql.nix index 1c43dad1d508..73447e3cf0d8 100644 --- a/nixos/modules/services/databases/postgresql.nix +++ b/nixos/modules/services/databases/postgresql.nix @@ -46,6 +46,7 @@ in services.postgresql = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to run PostgreSQL. @@ -53,6 +54,7 @@ in }; package = mkOption { + type = types.path; example = literalExample "pkgs.postgresql92"; description = '' PostgreSQL package to use. @@ -60,6 +62,7 @@ in }; port = mkOption { + type = types.int; default = "5432"; description = '' Port for PostgreSQL. @@ -67,6 +70,7 @@ in }; dataDir = mkOption { + type = types.path; default = "/var/db/postgresql"; description = '' Data directory for PostgreSQL. @@ -74,6 +78,7 @@ in }; authentication = mkOption { + type = types.lines; default = ""; description = '' Defines how users authenticate themselves to the server. @@ -81,6 +86,7 @@ in }; identMap = mkOption { + type = types.lines; default = ""; description = '' Defines the mapping from system users to database users. @@ -88,14 +94,15 @@ in }; initialScript = mkOption { - default = null; type = types.nullOr types.path; + default = null; description = '' A file containing SQL statements to execute on first startup. ''; }; enableTCPIP = mkOption { + type = types.bool; default = false; description = '' Whether to run PostgreSQL with -i flag to enable TCP/IP connections. @@ -103,8 +110,9 @@ in }; extraPlugins = mkOption { + type = types.listOf types.path; default = []; - example = "pkgs.postgis"; # of course don't use a string here! + example = literalExample "pkgs.postgis"; description = '' When this list contains elements a new store path is created. PostgreSQL and the elments are symlinked into it. Then pg_config, @@ -118,15 +126,16 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = "Additional text to be appended to postgresql.conf."; }; recoveryConfig = mkOption { + type = types.nullOr types.lines; default = null; - type = types.nullOr types.string; description = '' - Values to put into recovery.conf file. + Contents of the recovery.conf file. ''; }; }; diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix index 6a595f8306bc..adba6394dcf5 100644 --- a/nixos/modules/services/hardware/acpid.nix +++ b/nixos/modules/services/hardware/acpid.nix @@ -66,21 +66,25 @@ in services.acpid = { enable = mkOption { + type = types.bool; default = false; description = "Whether to enable the ACPI daemon."; }; powerEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on a button/power.* event."; }; lidEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on a button/lid.* event."; }; acEventCommands = mkOption { + type = types.lines; default = ""; description = "Shell commands to execute on an ac_adapter.* event."; }; diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix index 6bc0ad0bf774..b0714a3ce800 100644 --- a/nixos/modules/services/hardware/bluetooth.nix +++ b/nixos/modules/services/hardware/bluetooth.nix @@ -9,6 +9,7 @@ with pkgs.lib; options = { hardware.bluetooth.enable = mkOption { + type = types.bool; default = false; description = "Whether to enable support for Bluetooth."; }; diff --git a/nixos/modules/services/hardware/sane.nix b/nixos/modules/services/hardware/sane.nix index 905445f22c1b..5979feb82409 100644 --- a/nixos/modules/services/hardware/sane.nix +++ b/nixos/modules/services/hardware/sane.nix @@ -2,6 +2,12 @@ with pkgs.lib; +let + + pkg = if config.hardware.sane.snapshot then pkgs.saneBackendsGit else pkgs.saneBackends; + +in + { ###### interface @@ -9,11 +15,13 @@ with pkgs.lib; options = { hardware.sane.enable = mkOption { + type = types.bool; default = false; description = "Enable support for SANE scanners."; }; hardware.sane.snapshot = mkOption { + type = types.bool; default = false; description = "Use a development snapshot of SANE scanner drivers."; }; @@ -23,18 +31,13 @@ with pkgs.lib; ###### implementation - config = let pkg = if config.hardware.sane.snapshot - then pkgs.saneBackendsGit - else pkgs.saneBackends; - in mkIf config.hardware.sane.enable { - environment.systemPackages = [ pkg ]; - services.udev.packages = [ pkg ]; - - users.extraGroups = singleton { - name = "scanner"; - gid = config.ids.gids.scanner; - }; + config = mkIf config.hardware.sane.enable { - }; + environment.systemPackages = [ pkg ]; + services.udev.packages = [ pkg ]; + + users.extraGroups."scanner".gid = config.ids.gids.scanner; + + }; } diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix index 75f01fbc5a95..516569c02808 100644 --- a/nixos/modules/services/hardware/udev.nix +++ b/nixos/modules/services/hardware/udev.nix @@ -114,6 +114,7 @@ in options = { boot.hardwareScan = mkOption { + type = types.bool; default = true; description = '' Whether to try to load kernel modules for all detected hardware. diff --git a/nixos/modules/services/hardware/udisks.nix b/nixos/modules/services/hardware/udisks.nix index 1ba17c589d23..531ee192573a 100644 --- a/nixos/modules/services/hardware/udisks.nix +++ b/nixos/modules/services/hardware/udisks.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.udisks = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Udisks, a DBus service that allows diff --git a/nixos/modules/services/hardware/udisks2.nix b/nixos/modules/services/hardware/udisks2.nix index eae4172ccb3e..178ec379ff1b 100644 --- a/nixos/modules/services/hardware/udisks2.nix +++ b/nixos/modules/services/hardware/udisks2.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.udisks2 = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Udisks, a DBus service that allows diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix index 5d1658adb75f..4a9b13d4aa09 100644 --- a/nixos/modules/services/hardware/upower.nix +++ b/nixos/modules/services/hardware/upower.nix @@ -13,6 +13,7 @@ with pkgs.lib; services.upower = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable Upower, a DBus service that provides power diff --git a/nixos/modules/services/logging/syslogd.nix b/nixos/modules/services/logging/syslogd.nix index c1a66aaa3cc6..36a0ace927ae 100644 --- a/nixos/modules/services/logging/syslogd.nix +++ b/nixos/modules/services/logging/syslogd.nix @@ -55,7 +55,7 @@ in }; defaultConfig = mkOption { - type = types.string; + type = types.lines; default = defaultConf; description = '' The default syslog.conf file configures a @@ -73,7 +73,7 @@ in }; extraConfig = mkOption { - type = types.string; + type = types.lines; default = ""; example = "news.* -/var/log/news"; description = '' diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 6971fe496b22..1707828d0db6 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -66,8 +66,9 @@ in }; maxJobs = mkOption { + type = types.int; default = 1; - example = 2; + example = 64; description = " This option defines the maximum number of jobs that Nix will try to build in parallel. The default is 1. You should generally @@ -77,8 +78,8 @@ in }; useChroot = mkOption { + type = types.bool; default = false; - example = true; description = " If set, Nix will perform builds in a chroot-environment that it will set up automatically for each build. This prevents @@ -88,6 +89,7 @@ in }; chrootDirs = mkOption { + type = types.listOf types.str; default = []; example = [ "/dev" "/proc" ]; description = @@ -98,6 +100,7 @@ in }; extraOptions = mkOption { + type = types.lines; default = ""; example = '' gc-keep-outputs = true @@ -107,6 +110,7 @@ in }; distributedBuilds = mkOption { + type = types.bool; default = false; description = '' Whether to distribute builds to the machines listed in @@ -115,22 +119,25 @@ in }; daemonNiceLevel = mkOption { + type = types.int; default = 0; - description = " + description = '' Nix daemon process priority. This priority propagates to build processes. 0 is the default Unix process priority, 20 is the lowest. - "; + ''; }; daemonIONiceLevel = mkOption { + type = types.int; default = 0; - description = " + description = '' Nix daemon process I/O priority. This priority propagates to build processes. 0 is the default Unix process I/O priority, 7 is the lowest. - "; + ''; }; buildMachines = mkOption { + type = types.listOf types.attrs; default = []; example = [ { hostName = "voila.labs.cs.uu.nl"; @@ -176,24 +183,26 @@ in }; proxy = mkOption { + type = types.str; default = ""; - description = " + description = '' This option specifies the proxy to use for fetchurl. The real effect is just exporting http_proxy, https_proxy and ftp_proxy with that value. - "; + ''; example = "http://127.0.0.1:3128"; }; # Environment variables for running Nix. envVars = mkOption { + type = types.attrs; internal = true; default = {}; - type = types.attrs; description = "Environment variables used by Nix."; }; nrBuildUsers = mkOption { + type = types.int; default = 10; description = '' Number of nixbld user accounts created to @@ -204,6 +213,7 @@ in }; readOnlyStore = mkOption { + type = types.bool; default = true; description = '' If set, NixOS will enforce the immutability of the Nix store @@ -214,8 +224,8 @@ in }; binaryCaches = mkOption { + type = types.listOf types.str; default = [ http://cache.nixos.org/ ]; - type = types.listOf types.string; description = '' List of binary cache URLs used to obtain pre-built binaries of Nix packages. @@ -223,9 +233,9 @@ in }; trustedBinaryCaches = mkOption { + type = types.listOf types.str; default = [ ]; example = [ http://hydra.nixos.org/ ]; - type = types.listOf types.string; description = '' List of binary cache URLs that non-root users can use (in addition to those specified using diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix index f67afb747e97..885b8fa2d0ca 100644 --- a/nixos/modules/services/misc/nixos-manual.nix +++ b/nixos/modules/services/misc/nixos-manual.nix @@ -53,14 +53,15 @@ in options = { services.nixosManual.enable = mkOption { - default = true; type = types.bool; + default = true; description = '' Whether to build the NixOS manual pages. ''; }; services.nixosManual.showManual = mkOption { + type = types.bool; default = false; description = '' Whether to show the NixOS manual on one of the virtual @@ -76,6 +77,7 @@ in }; services.nixosManual.browser = mkOption { + type = types.path; default = "${pkgs.w3m}/bin/w3m"; description = '' Browser used to show the manual. diff --git a/nixos/modules/services/misc/rogue.nix b/nixos/modules/services/misc/rogue.nix index 94fa88507504..de25cc0fb982 100644 --- a/nixos/modules/services/misc/rogue.nix +++ b/nixos/modules/services/misc/rogue.nix @@ -17,6 +17,7 @@ in options = { services.rogue.enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the Rogue game on one of the virtual @@ -25,6 +26,7 @@ in }; services.rogue.tty = mkOption { + type = types.str; default = "tty9"; description = '' Virtual console on which to run Rogue. diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix index b24ac2d70325..4ed859c2e7ea 100644 --- a/nixos/modules/services/networking/firewall.nix +++ b/nixos/modules/services/networking/firewall.nix @@ -53,6 +53,7 @@ in options = { networking.firewall.enable = mkOption { + type = types.bool; default = false; description = '' @@ -64,6 +65,7 @@ in }; networking.firewall.logRefusedConnections = mkOption { + type = types.bool; default = true; description = '' @@ -72,6 +74,7 @@ in }; networking.firewall.logRefusedPackets = mkOption { + type = types.bool; default = false; description = '' @@ -82,6 +85,7 @@ in }; networking.firewall.logRefusedUnicastsOnly = mkOption { + type = types.bool; default = true; description = '' @@ -93,6 +97,7 @@ in }; networking.firewall.rejectPackets = mkOption { + type = types.bool; default = false; description = '' @@ -193,6 +198,7 @@ in }; networking.firewall.extraCommands = mkOption { + type = types.lines; default = ""; example = "iptables -A INPUT -p icmp -j ACCEPT"; description = diff --git a/nixos/modules/services/networking/nat.nix b/nixos/modules/services/networking/nat.nix index 9d62a764f060..ce28f0188284 100644 --- a/nixos/modules/services/networking/nat.nix +++ b/nixos/modules/services/networking/nat.nix @@ -19,6 +19,7 @@ in options = { networking.nat.enable = mkOption { + type = types.bool; default = false; description = '' @@ -27,6 +28,7 @@ in }; networking.nat.internalIPs = mkOption { + type = types.listOf types.str; example = [ "192.168.1.0/24" ] ; description = '' @@ -34,12 +36,10 @@ in coming from these networks and destined for the external interface will be rewritten. ''; - # Backward compatibility: this used to be a single range instead - # of a list. - apply = x: if isList x then x else [x]; }; networking.nat.externalInterface = mkOption { + type = types.str; example = "eth1"; description = '' @@ -48,7 +48,8 @@ in }; networking.nat.externalIP = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; example = "203.0.113.123"; description = '' @@ -86,7 +87,7 @@ in '' iptables -t nat -A POSTROUTING \ -s ${network} -o ${cfg.externalInterface} \ - ${if cfg.externalIP == "" + ${if cfg.externalIP == null then "-j MASQUERADE" else "-j SNAT --to-source ${cfg.externalIP}"} '' diff --git a/nixos/modules/services/networking/rpcbind.nix b/nixos/modules/services/networking/rpcbind.nix index 00c958c5a4a2..c966f85e260d 100644 --- a/nixos/modules/services/networking/rpcbind.nix +++ b/nixos/modules/services/networking/rpcbind.nix @@ -40,6 +40,7 @@ in services.rpcbind = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable `rpcbind', an ONC RPC directory service diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix index 360c745f3627..48eddb3b2f60 100644 --- a/nixos/modules/services/networking/ssh/sshd.nix +++ b/nixos/modules/services/networking/ssh/sshd.nix @@ -27,7 +27,7 @@ let openssh.authorizedKeys = { keys = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = '' A list of verbatim OpenSSH public keys that should be added to the @@ -39,6 +39,7 @@ let }; keyFiles = mkOption { + type = types.listOf types.str; default = []; description = '' A list of files each containing one OpenSSH public key that should be @@ -77,6 +78,7 @@ in services.openssh = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the OpenSSH secure shell daemon, which @@ -85,6 +87,7 @@ in }; forwardX11 = mkOption { + type = types.bool; default = cfgc.setXAuthLocation; description = '' Whether to allow X11 connections to be forwarded. @@ -92,6 +95,7 @@ in }; allowSFTP = mkOption { + type = types.bool; default = true; description = '' Whether to enable the SFTP subsystem in the SSH daemon. This @@ -112,6 +116,7 @@ in }; gatewayPorts = mkOption { + type = types.str; default = "no"; description = '' Specifies whether remote hosts are allowed to connect to @@ -122,6 +127,7 @@ in }; ports = mkOption { + type = types.listOf types.int; default = [22]; description = '' Specifies on which ports the SSH daemon listens. @@ -129,6 +135,7 @@ in }; passwordAuthentication = mkOption { + type = types.bool; default = true; description = '' Specifies whether password authentication is allowed. @@ -136,6 +143,7 @@ in }; challengeResponseAuthentication = mkOption { + type = types.bool; default = true; description = '' Specifies whether challenge/response authentication is allowed. @@ -143,6 +151,7 @@ in }; hostKeys = mkOption { + type = types.listOf types.attrs; default = [ { path = "/etc/ssh/ssh_host_dsa_key"; type = "dsa"; @@ -163,11 +172,13 @@ in }; authorizedKeysFiles = mkOption { + type = types.listOf types.str; default = []; description = "Files from with authorized keys are read."; }; extraConfig = mkOption { + type = types.lines; default = ""; description = "Verbatim contents of sshd_config."; }; @@ -202,7 +213,7 @@ in The path to the public key file for the host. The public key file is read at build time and saved in the Nix store. You can fetch a public key file from a running SSH server - with the ssh-keyscan command. + with the ssh-keyscan command. ''; }; }; diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index 1c3dc9d90b1d..951cef3eac07 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -49,6 +49,7 @@ in services.printing = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable printing support through the CUPS daemon. @@ -56,6 +57,8 @@ in }; bindirCmds = mkOption { + type = types.lines; + internal = true; default = ""; description = '' Additional commands executed while creating the directory @@ -64,6 +67,7 @@ in }; cupsdConf = mkOption { + type = types.lines; default = ""; example = '' @@ -77,13 +81,16 @@ in }; drivers = mkOption { - example = [ pkgs.splix ]; + type = types.listOf types.path; + example = literalExample "[ pkgs.splix ]"; description = '' - CUPS drivers (CUPS, gs and samba are added unconditionally). + CUPS drivers to use. Drivers provided by CUPS, Ghostscript + and Samba are added unconditionally. ''; }; tempDir = mkOption { + type = types.path; default = "/tmp"; example = "/tmp/cups"; description = '' diff --git a/nixos/modules/services/scheduling/atd.nix b/nixos/modules/services/scheduling/atd.nix index 8c96252668e3..c516c5889f12 100644 --- a/nixos/modules/services/scheduling/atd.nix +++ b/nixos/modules/services/scheduling/atd.nix @@ -17,18 +17,21 @@ in options = { services.atd.enable = mkOption { + type = types.bool; default = false; description = '' - Whether to enable the `at' daemon, a command scheduler. + Whether to enable the at daemon, a command scheduler. ''; }; services.atd.allowEveryone = mkOption { + type = types.bool; default = false; description = '' - Whether to make /var/spool/at{jobs,spool} writeable - by everyone (and sticky). This is normally not needed since - the `at' commands are setuid/setgid `atd'. + Whether to make /var/spool/at{jobs,spool} + writeable by everyone (and sticky). This is normally not + needed since the at commands are + setuid/setgid atd. ''; }; diff --git a/nixos/modules/services/scheduling/cron.nix b/nixos/modules/services/scheduling/cron.nix index e14f03fb1e83..44ed1ba5a078 100644 --- a/nixos/modules/services/scheduling/cron.nix +++ b/nixos/modules/services/scheduling/cron.nix @@ -11,7 +11,9 @@ let '' SHELL=${pkgs.bash}/bin/bash PATH=${config.system.path}/bin:${config.system.path}/sbin - MAILTO="${config.services.cron.mailto}" + ${optionalString (config.services.cron.mailto != null) '' + MAILTO="${config.services.cron.mailto}" + ''} NIX_CONF_DIR=/etc/nix ${pkgs.lib.concatStrings (map (job: job + "\n") config.services.cron.systemCronJobs)} ''; @@ -34,21 +36,25 @@ in services.cron = { enable = mkOption { + type = types.bool; default = true; - description = "Whether to enable the `vixie cron' daemon."; + description = "Whether to enable the Vixie cron daemon."; }; mailto = mkOption { - default = ""; - description = " The job output will be mailed to this email address. "; + type = types.nullOr types.str; + default = null; + description = "Email address to which job output will be mailed."; }; systemCronJobs = mkOption { + type = types.listOf types.str; default = []; - example = [ - "* * * * * test ls -l / > /tmp/cronout 2>&1" - "* * * * * eelco echo Hello World > /home/eelco/cronout" - ]; + example = literalExample '' + [ "* * * * * test ls -l / > /tmp/cronout 2>&1" + "* * * * * eelco echo Hello World > /home/eelco/cronout" + ] + ''; description = '' A list of Cron jobs to be appended to the system-wide crontab. See the manual page for crontab for the expected diff --git a/nixos/modules/services/scheduling/fcron.nix b/nixos/modules/services/scheduling/fcron.nix index 95ff918eb6d7..0c0811ca6e0e 100644 --- a/nixos/modules/services/scheduling/fcron.nix +++ b/nixos/modules/services/scheduling/fcron.nix @@ -6,7 +6,7 @@ let cfg = config.services.fcron; - queuelen = if cfg.queuelen == "" then "" else "-q ${toString cfg.queuelen}"; + queuelen = if cfg.queuelen == null then "" else "-q ${toString cfg.queuelen}"; systemCronJobs = '' @@ -34,33 +34,40 @@ in services.fcron = { enable = mkOption { + type = types.bool; default = false; - description = "Whether to enable the `fcron' daemon."; + description = "Whether to enable the fcron daemon."; }; allow = mkOption { + type = types.listOf types.str; default = [ "all" ]; description = '' - Users allowed to use fcrontab and fcrondyn (one name per line, "all" for everyone). + Users allowed to use fcrontab and fcrondyn (one name per + line, all for everyone). ''; }; deny = mkOption { + type = types.listOf types.str; default = []; description = "Users forbidden from using fcron."; }; maxSerialJobs = mkOption { + type = types.int; default = 1; description = "Maximum number of serial jobs which can run simultaneously."; }; queuelen = mkOption { - default = ""; - description = "Number of jobs the serial queue and the lavg queue can contain - empty to net set this number (-q)"; + type = types.nullOr types.int; + default = null; + description = "Number of jobs the serial queue and the lavg queue can contain."; }; systab = mkOption { + type = types.lines; default = ""; description = ''The "system" crontab contents.''; }; diff --git a/nixos/modules/services/system/dbus.nix b/nixos/modules/services/system/dbus.nix index 40d0853d19d5..cb5110f6feb3 100644 --- a/nixos/modules/services/system/dbus.nix +++ b/nixos/modules/services/system/dbus.nix @@ -77,6 +77,7 @@ in }; packages = mkOption { + type = types.listOf types.path; default = []; description = '' Packages whose D-Bus configuration files should be included in diff --git a/nixos/modules/services/system/nscd.nix b/nixos/modules/services/system/nscd.nix index e8534b120435..b817b1df779f 100644 --- a/nixos/modules/services/system/nscd.nix +++ b/nixos/modules/services/system/nscd.nix @@ -19,6 +19,7 @@ in services.nscd = { enable = mkOption { + type = types.bool; default = true; description = "Whether to enable the Name Service Cache Daemon."; }; diff --git a/nixos/modules/services/ttys/agetty.nix b/nixos/modules/services/ttys/agetty.nix index 850f558e4cb7..ae4fa87d4b7b 100644 --- a/nixos/modules/services/ttys/agetty.nix +++ b/nixos/modules/services/ttys/agetty.nix @@ -11,6 +11,7 @@ with pkgs.lib; services.mingetty = { greetingLine = mkOption { + type = types.str; default = ''<<< Welcome to NixOS ${config.system.nixosVersion} (\m) - \l >>>''; description = '' Welcome line printed by mingetty. @@ -18,6 +19,7 @@ with pkgs.lib; }; helpLine = mkOption { + type = types.lines; default = ""; description = '' Help line printed by mingetty below the welcome line. diff --git a/nixos/modules/services/ttys/gpm.nix b/nixos/modules/services/ttys/gpm.nix index 6a425cf327f4..74cee67aeae9 100644 --- a/nixos/modules/services/ttys/gpm.nix +++ b/nixos/modules/services/ttys/gpm.nix @@ -17,6 +17,7 @@ in services.gpm = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable GPM, the General Purpose Mouse daemon, @@ -25,6 +26,7 @@ in }; protocol = mkOption { + type = types.str; default = "ps/2"; description = "Mouse protocol to use."; }; diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index 7bb2d769780b..4bf1e33a2950 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -24,17 +24,18 @@ in services.xserver.desktopManager = { session = mkOption { + internal = true; default = []; example = singleton { name = "kde"; bgSupport = true; start = "..."; }; - description = " + description = '' Internal option used to add some common line to desktop manager scripts before forwarding the value to the displayManager. - "; + ''; apply = list: { list = map (d: d // { manage = "desktop"; diff --git a/nixos/modules/services/x11/desktop-managers/kde4.nix b/nixos/modules/services/x11/desktop-managers/kde4.nix index 079fc054d194..108b52bb951d 100644 --- a/nixos/modules/services/x11/desktop-managers/kde4.nix +++ b/nixos/modules/services/x11/desktop-managers/kde4.nix @@ -51,13 +51,13 @@ in services.xserver.desktopManager.kde4 = { enable = mkOption { + type = types.bool; default = false; - example = true; description = "Enable the KDE 4 desktop environment."; }; phononBackends = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = ["gstreamer"]; example = ["gstreamer" "vlc"]; description = "Which phonon multimedia backend kde should use"; diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix index d7621c82d12e..8199829ef90f 100644 --- a/nixos/modules/services/x11/desktop-managers/xfce.nix +++ b/nixos/modules/services/x11/desktop-managers/xfce.nix @@ -13,8 +13,8 @@ in options = { services.xserver.desktopManager.xfce.enable = mkOption { + type = types.bool; default = false; - example = true; description = "Enable the Xfce desktop environment."; }; diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index 0910708002bd..c4fce3706dcd 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -166,16 +166,19 @@ in services.xserver.displayManager = { xauthBin = mkOption { + internal = true; default = "${xorg.xauth}/bin/xauth"; description = "Path to the xauth program used by display managers."; }; xserverBin = mkOption { + type = types.path; default = "${xorg.xorgserver}/bin/X"; description = "Path to the X server used by display managers."; }; xserverArgs = mkOption { + type = types.listOf types.str; default = []; example = [ "-ac" "-logverbose" "-nolisten tcp" ]; description = "List of arguments for the X server."; @@ -183,16 +186,17 @@ in }; sessionCommands = mkOption { + type = types.lines; default = ""; example = '' xmessage "Hello World!" & ''; - type = types.string; description = "Shell commands executed just before the window or desktop manager is started."; }; desktopManagerHandlesLidAndPower = mkOption { + type = types.bool; default = true; description = '' Whether the display manager should prevent systemd from handling @@ -256,6 +260,7 @@ in }; environment = mkOption { + type = types.attrsOf types.unspecified; default = {}; example = { SLIM_CFGFILE = /etc/slim.conf; }; description = "Additional environment variables needed by the display manager."; diff --git a/nixos/modules/services/x11/display-managers/kdm.nix b/nixos/modules/services/x11/display-managers/kdm.nix index 2e84adcb4cef..c51e7edfddf3 100644 --- a/nixos/modules/services/x11/display-managers/kdm.nix +++ b/nixos/modules/services/x11/display-managers/kdm.nix @@ -40,7 +40,7 @@ let [X-*-Greeter] HiddenUsers=root,nixbld1,nixbld2,nixbld3,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9,nixbld10 PluginsLogin=${kdebase_workspace}/lib/kde4/kgreet_classic.so - ${optionalString (cfg.themeDirectory != "") + ${optionalString (cfg.themeDirectory != null) '' UseTheme=true Theme=${cfg.themeDirectory} @@ -78,6 +78,7 @@ in services.xserver.displayManager.kdm = { enable = mkOption { + type = types.bool; default = false; description = '' Whether to enable the KDE display manager. @@ -85,6 +86,7 @@ in }; enableXDMCP = mkOption { + type = types.bool; default = false; description = '' Whether to enable XDMCP, which allows remote logins. @@ -92,7 +94,8 @@ in }; themeDirectory = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; description = '' The path to a KDM theme directory. This theme will be used by the KDM greeter. @@ -100,6 +103,7 @@ in }; setupScript = mkOption { + type = types.lines; default = ""; description = '' The path to a KDM setup script. This script is run as root just @@ -109,6 +113,7 @@ in }; extraConfig = mkOption { + type = types.lines; default = ""; description = '' Options appended to kdmrc, the diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix index 01c9fa96c8c8..35834ef3764b 100644 --- a/nixos/modules/services/x11/display-managers/slim.nix +++ b/nixos/modules/services/x11/display-managers/slim.nix @@ -16,7 +16,7 @@ let login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session" halt_cmd ${config.systemd.package}/sbin/shutdown -h now reboot_cmd ${config.systemd.package}/sbin/shutdown -r now - ${optionalString (cfg.defaultUser != "") ("default_user " + cfg.defaultUser)} + ${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)} ${optionalString cfg.autoLogin "auto_login yes"} ''; @@ -45,6 +45,7 @@ in services.xserver.displayManager.slim = { enable = mkOption { + type = types.bool; default = config.services.xserver.enable; description = '' Whether to enable SLiM as the display manager. @@ -52,11 +53,14 @@ in }; theme = mkOption { + type = types.nullOr types.path; default = null; - example = pkgs.fetchurl { - url = http://download.berlios.de/slim/slim-wave.tar.gz; - sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy"; - }; + example = literalExample '' + pkgs.fetchurl { + url = http://download.berlios.de/slim/slim-wave.tar.gz; + sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy"; + } + ''; description = '' The theme for the SLiM login manager. If not specified, SLiM's default theme is used. See xorg.conf). @@ -299,12 +317,14 @@ in }; deviceSection = mkOption { + type = types.lines; default = ""; example = "VideoRAM 131072"; description = "Contents of the first Device section of the X server configuration file."; }; screenSection = mkOption { + type = types.lines; default = ""; example = '' Option "RandRRotation" "on" @@ -313,6 +333,7 @@ in }; monitorSection = mkOption { + type = types.lines; default = ""; example = "HorizSync 28-49"; description = "Contents of the first Monitor section of the X server configuration file."; @@ -334,6 +355,7 @@ in }; moduleSection = mkOption { + type = types.lines; default = ""; example = '' @@ -344,6 +366,7 @@ in }; serverLayoutSection = mkOption { + type = types.lines; default = ""; example = '' @@ -353,36 +376,40 @@ in }; extraDisplaySettings = mkOption { + type = types.lines; default = ""; example = "Virtual 2048 2048"; description = "Lines to be added to every Display subsection of the Screen section."; }; defaultDepth = mkOption { + type = types.int; default = 0; example = 8; description = "Default colour depth."; }; useXFS = mkOption { + # FIXME: what's the type of this option? default = false; example = "unix/:7100"; description = "Determines how to connect to the X Font Server."; }; tty = mkOption { + type = types.int; default = 7; - example = 9; description = "Virtual console for the X server."; }; display = mkOption { + type = types.int; default = 0; - example = 1; description = "Display number for the X server."; }; virtualScreen = mkOption { + type = types.nullOr types.attrs; default = null; example = { x = 2048; y = 2048; }; description = '' diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 06b857297ac9..6fd8bf241f50 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -92,8 +92,7 @@ let systemd = config.systemd.package; inherit children; - kernelParams = - config.boot.kernelParams ++ config.boot.extraKernelParams; + kernelParams = config.boot.kernelParams; installBootLoader = config.system.build.installBootLoader or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true"; @@ -162,6 +161,7 @@ in }; system.copySystemConfiguration = mkOption { + type = types.bool; default = false; description = '' If enabled, copies the NixOS configuration file diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 4cea6279e507..006909fbd0c8 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -24,7 +24,7 @@ in # We don't want to evaluate all of linuxPackages for the manual # - some of it might not even evaluate correctly. defaultText = "pkgs.linuxPackages"; - example = "pkgs.linuxPackages_2_6_25"; + example = literalExample "pkgs.linuxPackages_2_6_25"; description = '' This option allows you to override the Linux kernel used by NixOS. Since things like external kernel module packages are @@ -40,18 +40,9 @@ in }; boot.kernelParams = mkOption { + type = types.listOf types.str; default = [ ]; - description = '' - The kernel parameters. If you want to add additional - parameters, it's best to set - . - ''; - }; - - boot.extraKernelParams = mkOption { - default = [ ]; - example = [ "boot.trace" ]; - description = "Additional user-defined kernel parameters."; + description = "Parameters added to the kernel command line."; }; boot.consoleLogLevel = mkOption { @@ -65,6 +56,7 @@ in }; boot.vesa = mkOption { + type = types.bool; default = false; description = '' Whether to activate VESA video mode on boot. @@ -72,13 +64,14 @@ in }; boot.extraModulePackages = mkOption { + type = types.listOf types.path; default = []; - # !!! example = [pkgs.nvidia_x11]; + example = literalExample "[ pkgs.linuxPackages.nvidia_x11 ]"; description = "A list of additional packages supplying kernel modules."; }; boot.kernelModules = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = '' The set of kernel modules to be loaded in the second stage of @@ -90,7 +83,7 @@ in }; boot.initrd.availableKernelModules = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; example = [ "sata_nv" "ext3" ]; description = '' @@ -111,7 +104,7 @@ in }; boot.initrd.kernelModules = mkOption { - type = types.listOf types.string; + type = types.listOf types.str; default = []; description = "List of modules that are always loaded by the initrd."; }; diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 56cb7cbeaa69..8b3923e30a05 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -78,7 +78,7 @@ in devices = mkOption { default = []; example = [ "/dev/hda" ]; - type = types.listOf types.string; + type = types.listOf types.str; description = '' The devices on which the boot loader, GRUB, will be installed. Can be used instead of device to diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix index 8b2762e2526d..39928da8d190 100644 --- a/nixos/modules/system/boot/modprobe.nix +++ b/nixos/modules/system/boot/modprobe.nix @@ -36,6 +36,7 @@ with pkgs.lib; }; boot.blacklistedKernelModules = mkOption { + type = types.listOf types.str; default = []; example = [ "cirrusfb" "i2c_piix4" ]; description = '' diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 71dc29feb2a8..b2b662803728 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -243,39 +243,39 @@ in default = true; type = types.bool; description = '' - Whether to run fsck on journaling filesystems such as ext3. + Whether to run fsck on journaling filesystems such as ext3. ''; }; boot.initrd.mdadmConf = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' - Contents of /etc/mdadm.conf at initrd. + Contents of /etc/mdadm.conf in stage 1. ''; }; boot.initrd.preLVMCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' - Shell commands to be executed immediately before lvm discovery. + Shell commands to be executed immediately before LVM discovery. ''; }; boot.initrd.postDeviceCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed immediately after stage 1 of the boot has loaded kernel modules and created device nodes in - /dev. + /dev. ''; }; boot.initrd.postMountCommands = mkOption { default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed immediately after the stage 1 filesystems have been mounted. @@ -285,7 +285,7 @@ in boot.initrd.extraUtilsCommands = mkOption { internal = true; default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed in the builder of the extra-utils derivation. This can be used to provide @@ -296,7 +296,7 @@ in boot.initrd.extraUtilsCommandsTest = mkOption { internal = true; default = ""; - type = with types; string; + type = types.lines; description = '' Shell commands to be executed in the builder of the extra-utils derivation after patchelf has done its @@ -306,12 +306,10 @@ in }; boot.initrd.compressor = mkOption { + internal = true; default = "gzip -9"; - - type = types.string; - - description = "The compressor to use on the initrd"; - + type = types.str; + description = "The compressor to use on the initrd image."; example = "xz"; }; diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix index 0af4c9f7a582..aa0d7e0c138b 100644 --- a/nixos/modules/system/boot/stage-2.nix +++ b/nixos/modules/system/boot/stage-2.nix @@ -43,7 +43,7 @@ in postBootCommands = mkOption { default = ""; example = "rm -f /var/log/messages"; - type = types.string; + type = types.lines; description = '' Shell commands to be executed just before systemd is started. ''; @@ -80,10 +80,10 @@ in }; cleanTmpDir = mkOption { + type = types.bool; default = false; - example = true; description = '' - Delete all files in /tmp/ during boot. + Whether to delete all files in /tmp during boot. ''; }; diff --git a/nixos/modules/system/etc/etc.nix b/nixos/modules/system/etc/etc.nix index b22259b6d632..a8f0a59b6fa9 100644 --- a/nixos/modules/system/etc/etc.nix +++ b/nixos/modules/system/etc/etc.nix @@ -57,6 +57,7 @@ in }; target = mkOption { + type = types.str; description = '' Name of symlink (relative to /etc). Defaults to the attribute @@ -66,7 +67,7 @@ in text = mkOption { default = null; - type = types.nullOr types.string; + type = types.nullOr types.lines; description = "Text of the file."; }; @@ -76,6 +77,7 @@ in }; mode = mkOption { + type = types.str; default = "symlink"; example = "0600"; description = '' diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix index 8f441aa134d4..ce36a8bab096 100644 --- a/nixos/modules/tasks/cpu-freq.nix +++ b/nixos/modules/tasks/cpu-freq.nix @@ -8,9 +8,9 @@ with pkgs.lib; options = { powerManagement.cpuFreqGovernor = mkOption { - default = ""; + type = types.nullOr types.str; + default = null; example = "ondemand"; - type = types.str; description = '' Configure the governor used to regulate the frequence of the available CPUs. By default, the kernel configures the @@ -23,7 +23,7 @@ with pkgs.lib; ###### implementation - config = mkIf (config.powerManagement.cpuFreqGovernor != "") { + config = mkIf (config.powerManagement.cpuFreqGovernor != null) { environment.systemPackages = [ pkgs.cpufrequtils ]; diff --git a/nixos/tests/bittorrent.nix b/nixos/tests/bittorrent.nix index 180da8267e0f..6e67edb0b820 100644 --- a/nixos/tests/bittorrent.nix +++ b/nixos/tests/bittorrent.nix @@ -40,7 +40,7 @@ in { environment.systemPackages = [ pkgs.miniupnpd ]; virtualisation.vlans = [ 1 2 ]; networking.nat.enable = true; - networking.nat.internalIPs = "192.168.2.0/24"; + networking.nat.internalIPs = [ "192.168.2.0/24" ]; networking.nat.externalInterface = "eth1"; }; diff --git a/nixos/tests/nat.nix b/nixos/tests/nat.nix index 55d87ed4fa14..a13714d60a94 100644 --- a/nixos/tests/nat.nix +++ b/nixos/tests/nat.nix @@ -20,7 +20,7 @@ { config, pkgs, ... }: { virtualisation.vlans = [ 2 1 ]; networking.nat.enable = true; - networking.nat.internalIPs = "192.168.1.0/24"; + networking.nat.internalIPs = [ "192.168.1.0/24" ]; networking.nat.externalInterface = "eth1"; };