nixos/*: add trivial defaultText for options with simple defaults

This commit is contained in:
pennae 2021-11-26 01:16:05 +01:00
parent 80c7745b4e
commit 2512455639
57 changed files with 101 additions and 2 deletions

View File

@ -39,6 +39,7 @@ in
decompressFonts = mkOption {
type = types.bool;
default = config.programs.xwayland.enable;
defaultText = literalExpression "config.programs.xwayland.enable";
description = ''
Whether to decompress fonts in
<filename>/run/current-system/sw/share/X11/fonts</filename>.

View File

@ -6,6 +6,7 @@ with lib;
gtk.iconCache.enable = mkOption {
type = types.bool;
default = config.services.xserver.enable;
defaultText = literalExpression "config.services.xserver.enable";
description = ''
Whether to build icon theme caches for GTK applications.
'';

View File

@ -14,6 +14,12 @@ with lib;
allLocales = any (x: x == "all") config.i18n.supportedLocales;
locales = config.i18n.supportedLocales;
};
defaultText = literalExpression ''
pkgs.buildPackages.glibcLocales.override {
allLocales = any (x: x == "all") config.i18n.supportedLocales;
locales = config.i18n.supportedLocales;
}
'';
example = literalExpression "pkgs.glibcLocales";
description = ''
Customized pkg.glibcLocales package.

View File

@ -37,7 +37,7 @@ in
type = listOfMaintainers;
internal = true;
default = [];
example = [ lib.maintainers.all ];
example = literalExpression ''[ lib.maintainers.all ]'';
description = ''
List of maintainers of each module. This option should be defined at
most once per module.

View File

@ -38,6 +38,7 @@ let
p11Auth = mkOption {
default = config.security.pam.p11.enable;
defaultText = literalExpression "config.security.pam.p11.enable";
type = types.bool;
description = ''
If set, keys listed in
@ -49,6 +50,7 @@ let
u2fAuth = mkOption {
default = config.security.pam.u2f.enable;
defaultText = literalExpression "config.security.pam.u2f.enable";
type = types.bool;
description = ''
If set, users listed in
@ -61,6 +63,7 @@ let
yubicoAuth = mkOption {
default = config.security.pam.yubico.enable;
defaultText = literalExpression "config.security.pam.yubico.enable";
type = types.bool;
description = ''
If set, users listed in
@ -83,6 +86,7 @@ let
usbAuth = mkOption {
default = config.security.pam.usb.enable;
defaultText = literalExpression "config.security.pam.usb.enable";
type = types.bool;
description = ''
If set, users listed in
@ -93,6 +97,7 @@ let
otpwAuth = mkOption {
default = config.security.pam.enableOTPW;
defaultText = literalExpression "config.security.pam.enableOTPW";
type = types.bool;
description = ''
If set, the OTPW system will be used (if
@ -126,6 +131,7 @@ let
fprintAuth = mkOption {
default = config.services.fprintd.enable;
defaultText = literalExpression "config.services.fprintd.enable";
type = types.bool;
description = ''
If set, fingerprint reader will be used (if exists and
@ -135,6 +141,7 @@ let
oathAuth = mkOption {
default = config.security.pam.oath.enable;
defaultText = literalExpression "config.security.pam.oath.enable";
type = types.bool;
description = ''
If set, the OATH Toolkit will be used.
@ -249,6 +256,7 @@ let
pamMount = mkOption {
default = config.security.pam.mount.enable;
defaultText = literalExpression "config.security.pam.mount.enable";
type = types.bool;
description = ''
Enable PAM mount (pam_mount) system to mount fileystems on user login.

View File

@ -50,6 +50,7 @@ in {
type = types.nullOr types.str;
description = "DNS name or IP address that will be used for the stream directory lookups or possibily the playlist generation if a Host header is not provided.";
default = config.networking.domain;
defaultText = literalExpression "config.networking.domain";
};
admin = {

View File

@ -31,6 +31,7 @@ in {
port = mkOption {
type = types.int;
default = config.services.mpd.network.port;
defaultText = literalExpression "config.services.mpd.network.port";
description = "The port where MPD is listening.";
example = 6600;
};

View File

@ -302,6 +302,7 @@ in {
name = mkOption {
default = "${config.networking.hostName}-fd";
defaultText = literalExpression ''"''${config.networking.hostName}-fd"'';
type = types.str;
description = ''
The client name that must be used by the Director when connecting.
@ -364,6 +365,7 @@ in {
name = mkOption {
default = "${config.networking.hostName}-sd";
defaultText = literalExpression ''"''${config.networking.hostName}-sd"'';
type = types.str;
description = ''
Specifies the Name of the Storage daemon.
@ -439,6 +441,7 @@ in {
name = mkOption {
default = "${config.networking.hostName}-dir";
defaultText = literalExpression ''"''${config.networking.hostName}-dir"'';
type = types.str;
description = ''
The director name used by the system administrator. This directive is

View File

@ -168,6 +168,7 @@ in
hostname = mkOption {
description = "Kubernetes kubelet hostname override.";
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
type = str;
};

View File

@ -98,6 +98,7 @@ in
the public and private keys respectively.
'';
default = "${config.services.cfssl.dataDir}/ca";
defaultText = literalExpression ''"''${config.services.cfssl.dataDir}/ca"'';
type = str;
};

View File

@ -37,6 +37,7 @@ in
hostname = mkOption {
description = "Kubernetes proxy hostname override.";
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
type = str;
};

View File

@ -80,6 +80,7 @@ in
dbdHost = mkOption {
type = types.str;
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
description = ''
Hostname of the machine where <literal>slurmdbd</literal>
is running (i.e. name returned by <literal>hostname -s</literal>).

View File

@ -58,6 +58,7 @@ in
'';
example = "nixos";
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
};
runnerGroup = mkOption {

View File

@ -203,6 +203,7 @@ in
buildMachinesFiles = mkOption {
type = types.listOf types.path;
default = optional (config.nix.buildMachines != []) "/etc/nix/machines";
defaultText = literalExpression ''optional (config.nix.buildMachines != []) "/etc/nix/machines"'';
example = [ "/etc/nix/machines" "/var/lib/hydra/provisioner/machines" ];
description = "List of files containing build machines.";
};

View File

@ -74,6 +74,7 @@ in {
mailFrom = mkOption {
type = types.str;
default = "journalwatch@${config.networking.hostName}";
defaultText = literalExpression ''"journalwatch@''${config.networking.hostName}"'';
description = ''
Mail address to send journalwatch reports from.
'';

View File

@ -10,6 +10,7 @@ with lib;
services.klogd.enable = mkOption {
type = types.bool;
default = versionOlder (getVersion config.boot.kernelPackages.kernel) "3.5";
defaultText = literalExpression ''versionOlder (getVersion config.boot.kernelPackages.kernel) "3.5"'';
description = ''
Whether to enable klogd, the kernel log message processing
daemon. Since systemd handles logging of kernel messages on

View File

@ -55,6 +55,7 @@ in {
domains = mkOption {
type = types.str;
default = "csl:${config.networking.hostName}";
defaultText = literalExpression ''"csl:''${config.networking.hostName}"'';
example = "csl:example.com,mydomain.net";
description = ''
Local domains set (see <literal>opendkim(8)</literal> for more information on datasets).

View File

@ -17,6 +17,7 @@ in {
name = mkOption {
description = "Etcd unique node name.";
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
type = types.str;
};

View File

@ -475,6 +475,7 @@ in {
host = mkOption {
type = types.str;
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
description = "GitLab host name. Used e.g. for copy-paste URLs.";
};
@ -534,6 +535,7 @@ in {
host = mkOption {
type = types.str;
default = config.services.gitlab.host;
defaultText = literalExpression "config.services.gitlab.host";
description = "GitLab container registry host name.";
};
port = mkOption {

View File

@ -98,6 +98,9 @@ in {
serviceDependencies = mkOption {
type = with types; listOf str;
default = optional config.services.matrix-synapse.enable "matrix-synapse.service";
defaultText = literalExpression ''
optional config.services.matrix-synapse.enable "matrix-synapse.service"
'';
description = ''
List of Systemd services to require and wait for when starting the application service,
such as the Matrix homeserver if it's running on the same host.

View File

@ -227,6 +227,7 @@ in {
type = types.str;
example = "example.com";
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
description = ''
The domain name of the server, with optional explicit port.
This is used by remote servers to look up the server address.
@ -379,6 +380,11 @@ in {
default = if versionAtLeast config.system.stateVersion "18.03"
then "psycopg2"
else "sqlite3";
defaultText = literalExpression ''
if versionAtLeast config.system.stateVersion "18.03"
then "psycopg2"
else "sqlite3"
'';
description = ''
The database engine name. Can be sqlite or psycopg2.
'';

View File

@ -108,6 +108,9 @@ in {
serviceDependencies = mkOption {
type = with types; listOf str;
default = optional config.services.matrix-synapse.enable "matrix-synapse.service";
defaultText = literalExpression ''
optional config.services.matrix-synapse.enable "matrix-synapse.service"
'';
description = ''
List of Systemd services to require and wait for when starting the application service.
'';

View File

@ -18,6 +18,7 @@ in {
klipperSocket = mkOption {
type = types.path;
default = config.services.klipper.apiSocket;
defaultText = literalExpression "config.services.klipper.apiSocket";
description = "Path to Klipper's API socket.";
};

View File

@ -67,6 +67,9 @@ in {
serviceDependencies = mkOption {
type = with types; listOf str;
default = optional config.services.matrix-synapse.enable "matrix-synapse.service";
defaultText = literalExpression ''
optional config.services.matrix-synapse.enable "matrix-synapse.service"
'';
description = ''
List of Systemd services to require and wait for when starting the application service.
'';

View File

@ -71,6 +71,9 @@ in
originBase = mkOption {
type = types.str;
default = with config.networking; hostName + lib.optionalString (domain != null) ".${domain}";
defaultText = literalExpression ''
with config.networking; hostName + optionalString (domain != null) ".''${domain}"
'';
description = ''
Host name used by reverse-proxy and for default settings. Will host services at git."''${originBase}". For example: git.sr.ht
'';

View File

@ -18,6 +18,7 @@ with lib;
package = mkOption {
type = types.package;
default = pkgs.xmrig;
defaultText = literalExpression "pkgs.xmrig";
example = literalExpression "pkgs.xmrig-mo";
description = "XMRig package to use.";
};

View File

@ -324,6 +324,7 @@ in {
mongoUrl = mkOption {
default = "mongodb://${config.services.mongodb.bind_ip}:27017/seyren";
defaultText = literalExpression ''"mongodb://''${config.services.mongodb.bind_ip}:27017/seyren"'';
description = "Mongodb connection string.";
type = types.str;
};

View File

@ -131,6 +131,7 @@ in
validateConfig = mkOption {
type = types.bool;
default = pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform;
defaultText = literalExpression "pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform";
description = "if true, the syntax of the nagios configuration file is checked at build time";
};

View File

@ -93,6 +93,7 @@ in
dashboard = lib.mkOption {
type = lib.types.bool;
default = config.services.grafana.enable;
defaultText = lib.literalExpression "config.services.grafana.enable";
description = ''
Whether the official parsedmarc grafana dashboard should
be provisioned to the local grafana instance.

View File

@ -125,6 +125,7 @@ in
mail = {
enable = mkOption {
default = config.services.mail.sendmailSetuidWrapper != null;
defaultText = literalExpression "config.services.mail.sendmailSetuidWrapper != null";
type = types.bool;
description = "Whenever to send e-mail notifications.";
};
@ -169,12 +170,14 @@ in
x11 = {
enable = mkOption {
default = config.services.xserver.enable;
defaultText = literalExpression "config.services.xserver.enable";
type = types.bool;
description = "Whenever to send X11 xmessage notifications.";
};
display = mkOption {
default = ":${toString config.services.xserver.display}";
defaultText = literalExpression ''":''${toString config.services.xserver.display}"'';
type = types.str;
description = "DISPLAY to send X11 notifications to.";
};

View File

@ -79,6 +79,11 @@ in
if versionAtLeast config.system.stateVersion "17.09"
then "/var/lib/ipfs"
else "/var/lib/ipfs/.ipfs";
defaultText = literalExpression ''
if versionAtLeast config.system.stateVersion "17.09"
then "/var/lib/ipfs"
else "/var/lib/ipfs/.ipfs"
'';
description = "The data dir for IPFS";
};

View File

@ -144,6 +144,7 @@ in
forwarders = mkOption {
default = config.networking.nameservers;
defaultText = literalExpression "config.networking.nameservers";
type = types.listOf types.str;
description = "
List of servers we should forward requests to.

View File

@ -193,6 +193,7 @@ in {
realm = mkOption {
type = types.str;
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
example = "example.com";
description = ''
The default realm to be used for the users when no explicit

View File

@ -145,6 +145,7 @@ in {
providerName = mkOption {
type = types.str;
default = "2.dnscrypt-cert.${config.networking.hostName}";
defaultText = literalExpression ''"2.dnscrypt-cert.''${config.networking.hostName}"'';
example = "2.dnscrypt-cert.myresolver";
description = ''
The name that will be given to this DNSCrypt resolver.

View File

@ -93,6 +93,9 @@ in {
'';
type = types.nullOr types.str;
default = with config.networking; (hostName + optionalString (domain != null) ".${domain}");
defaultText = literalExpression ''
with config.networking; (hostName + optionalString (domain != null) ".''${domain}")
'';
example = "node1.example.com";
};

View File

@ -76,6 +76,7 @@ in
identity.hostname = mkOption {
type = types.str;
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
example = "example.com";
description = ''
The hostname of this ncdns instance, which defaults to the machine

View File

@ -603,6 +603,7 @@ in
reuseport = mkOption {
type = types.bool;
default = pkgs.stdenv.isLinux;
defaultText = literalExpression "pkgs.stdenv.isLinux";
description = ''
Whether to enable SO_REUSEPORT on all used sockets. This lets multiple
processes bind to the same port. This speeds up operation especially

View File

@ -52,6 +52,7 @@ in
servers = mkOption {
default = config.networking.timeServers;
defaultText = literalExpression "config.networking.timeServers";
type = types.listOf types.str;
description = ''
The set of NTP servers from which to synchronise.

View File

@ -77,6 +77,7 @@ in
servers = mkOption {
default = config.networking.timeServers;
defaultText = literalExpression "config.networking.timeServers";
type = types.listOf types.str;
description = ''
The set of NTP servers from which to synchronise.

View File

@ -23,6 +23,7 @@ in
servers = mkOption {
default = config.services.ntp.servers;
defaultText = literalExpression "config.services.ntp.servers";
type = types.listOf types.str;
inherit (options.services.ntp.servers) description;
};

View File

@ -58,6 +58,7 @@ in
type = types.str;
example = "Voltron";
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
description = ''
Name of the Resilio Sync device.
'';

View File

@ -124,6 +124,7 @@ in {
type = types.package;
description = "Which package to use for the seafile server.";
default = pkgs.seafile-server;
defaultText = literalExpression "pkgs.seafile-server";
};
seahubExtraConf = mkOption {

View File

@ -49,6 +49,7 @@ in {
nameservers = mkOption {
default = map (n: n + ":53") config.networking.nameservers;
defaultText = literalExpression ''map (n: n + ":53") config.networking.nameservers'';
type = types.listOf types.str;
description = "Skydns list of nameservers to forward DNS requests to when not authoritative for a domain.";
example = ["8.8.8.8:53" "8.8.4.4:53"];

View File

@ -241,6 +241,12 @@ in
+ FPing
binary = ${config.security.wrapperDir}/fping
'';
defaultText = literalExpression ''
'''
+ FPing
binary = ''${config.security.wrapperDir}/fping
'''
'';
description = "Probe configuration";
};
sendmail = mkOption {

View File

@ -43,6 +43,7 @@ in
hostName = mkOption {
type = types.str;
default = config.networking.hostName;
defaultText = literalExpression "config.networking.hostName";
description = "Server hostname.";
};

View File

@ -8,6 +8,7 @@ in
proxy = mkOption {
type = types.str;
default = config.services.oauth2_proxy.httpAddress;
defaultText = literalExpression "config.services.oauth2_proxy.httpAddress";
description = ''
The address of the reverse proxy endpoint for oauth2_proxy
'';

View File

@ -37,6 +37,7 @@ in
enable = mkOption {
type = types.bool;
default = config.services.tor.enable && config.services.tor.client.enable;
defaultText = literalExpression "config.services.tor.enable && config.services.tor.client.enable";
description = ''
Whether to build <literal>/etc/tor/torsocks.conf</literal>
containing the specified global torsocks configuration.

View File

@ -79,6 +79,7 @@ in
email = mkOption {
type = types.str;
default = "ihatemoney@${config.networking.hostName}";
defaultText = literalExpression ''"ihatemoney@''${config.networking.hostName}"'';
description = "The email of the sender of ihatemoney emails";
};
};

View File

@ -9,6 +9,7 @@ in
package = mkOption {
type = types.package;
default = pkgs.openwebrx;
defaultText = literalExpression "pkgs.openwebrx";
description = "OpenWebRX package to use for the service";
};
};

View File

@ -234,6 +234,7 @@ in {
package = lib.mkOption {
type = lib.types.package;
default = pkgs.peertube;
defaultText = lib.literalExpression "pkgs.peertube";
description = "Peertube package to use.";
};
};

View File

@ -42,6 +42,7 @@ in
stateDir = mkOption {
type = types.path;
default = "/var/spool/varnish/${config.networking.hostName}";
defaultText = literalExpression ''"/var/spool/varnish/''${config.networking.hostName}"'';
description = "
Directory holding all state for Varnish to run.
";

View File

@ -201,6 +201,7 @@ in
system.boot.loader.kernelFile = mkOption {
internal = true;
default = pkgs.stdenv.hostPlatform.linux-kernel.target;
defaultText = literalExpression "pkgs.stdenv.hostPlatform.linux-kernel.target";
type = types.str;
description = ''
Name of the kernel file to be passed to the bootloader.

View File

@ -99,6 +99,7 @@ in
enable = mkOption {
default = !config.boot.isContainer;
defaultText = literalExpression "!config.boot.isContainer";
type = types.bool;
description = ''
Whether to enable the GNU GRUB boot loader.

View File

@ -32,6 +32,7 @@ in
services.resolved.domains = mkOption {
default = config.networking.search;
defaultText = literalExpression "config.networking.search";
example = [ "example.com" ];
type = types.listOf types.str;
description = ''

View File

@ -9,6 +9,7 @@ with lib;
services.timesyncd = {
enable = mkOption {
default = !config.boot.isContainer;
defaultText = literalExpression "!config.boot.isContainer";
type = types.bool;
description = ''
Enables the systemd NTP client daemon.
@ -16,6 +17,7 @@ with lib;
};
servers = mkOption {
default = config.networking.timeServers;
defaultText = literalExpression "config.networking.timeServers";
type = types.listOf types.str;
description = ''
The set of NTP servers from which to synchronise.

View File

@ -1,6 +1,6 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) types;
inherit (lib) literalExpression types;
in {
options = {
ec2 = {
@ -50,6 +50,7 @@ in {
};
efi = lib.mkOption {
default = pkgs.stdenv.hostPlatform.isAarch64;
defaultText = literalExpression "pkgs.stdenv.hostPlatform.isAarch64";
internal = true;
description = ''
Whether the EC2 instance is using EFI.

View File

@ -329,6 +329,7 @@ in
mkOption {
type = types.str;
default = "./${config.system.name}.qcow2";
defaultText = literalExpression ''"./''${config.system.name}.qcow2"'';
description =
''
Path to the disk image containing the root filesystem.
@ -678,6 +679,7 @@ in
mkOption {
type = types.str;
default = "./${config.system.name}-efi-vars.fd";
defaultText = literalExpression ''"./''${config.system.name}-efi-vars.fd"'';
description =
''
Path to nvram image containing UEFI variables. The will be created