From 25124556397ba17bfd70297000270de1e6523b0a Mon Sep 17 00:00:00 2001 From: pennae Date: Fri, 26 Nov 2021 01:16:05 +0100 Subject: nixos/*: add trivial defaultText for options with simple defaults --- nixos/modules/config/fonts/fontdir.nix | 1 + nixos/modules/config/gtk/gtk-icon-cache.nix | 1 + nixos/modules/config/i18n.nix | 6 ++++++ nixos/modules/misc/meta.nix | 2 +- nixos/modules/security/pam.nix | 8 ++++++++ nixos/modules/services/audio/icecast.nix | 1 + nixos/modules/services/audio/ympd.nix | 1 + nixos/modules/services/backup/bacula.nix | 3 +++ nixos/modules/services/cluster/kubernetes/kubelet.nix | 1 + nixos/modules/services/cluster/kubernetes/pki.nix | 1 + nixos/modules/services/cluster/kubernetes/proxy.nix | 1 + nixos/modules/services/computing/slurm/slurm.nix | 1 + nixos/modules/services/continuous-integration/github-runner.nix | 1 + nixos/modules/services/continuous-integration/hydra/default.nix | 1 + nixos/modules/services/logging/journalwatch.nix | 1 + nixos/modules/services/logging/klogd.nix | 1 + nixos/modules/services/mail/opendkim.nix | 1 + nixos/modules/services/misc/etcd.nix | 1 + nixos/modules/services/misc/gitlab.nix | 2 ++ nixos/modules/services/misc/matrix-appservice-discord.nix | 3 +++ nixos/modules/services/misc/matrix-synapse.nix | 6 ++++++ nixos/modules/services/misc/mautrix-telegram.nix | 3 +++ nixos/modules/services/misc/moonraker.nix | 1 + nixos/modules/services/misc/mx-puppet-discord.nix | 3 +++ nixos/modules/services/misc/sourcehut/default.nix | 3 +++ nixos/modules/services/misc/xmrig.nix | 1 + nixos/modules/services/monitoring/graphite.nix | 1 + nixos/modules/services/monitoring/nagios.nix | 1 + nixos/modules/services/monitoring/parsedmarc.nix | 1 + nixos/modules/services/monitoring/smartd.nix | 3 +++ nixos/modules/services/network-filesystems/ipfs.nix | 5 +++++ nixos/modules/services/networking/bind.nix | 1 + nixos/modules/services/networking/coturn.nix | 1 + nixos/modules/services/networking/dnscrypt-wrapper.nix | 1 + nixos/modules/services/networking/flannel.nix | 3 +++ nixos/modules/services/networking/ncdns.nix | 1 + nixos/modules/services/networking/nsd.nix | 1 + nixos/modules/services/networking/ntp/chrony.nix | 1 + nixos/modules/services/networking/ntp/ntpd.nix | 1 + nixos/modules/services/networking/ntp/openntpd.nix | 1 + nixos/modules/services/networking/resilio.nix | 1 + nixos/modules/services/networking/seafile.nix | 1 + nixos/modules/services/networking/skydns.nix | 1 + nixos/modules/services/networking/smokeping.nix | 6 ++++++ nixos/modules/services/networking/soju.nix | 1 + nixos/modules/services/security/oauth2_proxy_nginx.nix | 1 + nixos/modules/services/security/torsocks.nix | 1 + nixos/modules/services/web-apps/ihatemoney/default.nix | 1 + nixos/modules/services/web-apps/openwebrx.nix | 1 + nixos/modules/services/web-apps/peertube.nix | 1 + nixos/modules/services/web-servers/varnish/default.nix | 1 + nixos/modules/system/activation/top-level.nix | 1 + nixos/modules/system/boot/loader/grub/grub.nix | 1 + nixos/modules/system/boot/resolved.nix | 1 + nixos/modules/system/boot/timesyncd.nix | 2 ++ nixos/modules/virtualisation/amazon-options.nix | 3 ++- nixos/modules/virtualisation/qemu-vm.nix | 2 ++ 57 files changed, 101 insertions(+), 2 deletions(-) diff --git a/nixos/modules/config/fonts/fontdir.nix b/nixos/modules/config/fonts/fontdir.nix index db4b6c638ab..560918302ca 100644 --- a/nixos/modules/config/fonts/fontdir.nix +++ b/nixos/modules/config/fonts/fontdir.nix @@ -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 /run/current-system/sw/share/X11/fonts. diff --git a/nixos/modules/config/gtk/gtk-icon-cache.nix b/nixos/modules/config/gtk/gtk-icon-cache.nix index 7441f4de40e..ff9aa7c6a04 100644 --- a/nixos/modules/config/gtk/gtk-icon-cache.nix +++ b/nixos/modules/config/gtk/gtk-icon-cache.nix @@ -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. ''; diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 545d4a3dca6..5b8d5b21449 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -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. diff --git a/nixos/modules/misc/meta.nix b/nixos/modules/misc/meta.nix index 1410e33342a..3dd97cbec23 100644 --- a/nixos/modules/misc/meta.nix +++ b/nixos/modules/misc/meta.nix @@ -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. diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix index b03bf290fd2..8ed7a721a3e 100644 --- a/nixos/modules/security/pam.nix +++ b/nixos/modules/security/pam.nix @@ -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. diff --git a/nixos/modules/services/audio/icecast.nix b/nixos/modules/services/audio/icecast.nix index 6ca20a7a108..5ee5bd745f9 100644 --- a/nixos/modules/services/audio/icecast.nix +++ b/nixos/modules/services/audio/icecast.nix @@ -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 = { diff --git a/nixos/modules/services/audio/ympd.nix b/nixos/modules/services/audio/ympd.nix index 36c5527027f..84b72d14251 100644 --- a/nixos/modules/services/audio/ympd.nix +++ b/nixos/modules/services/audio/ympd.nix @@ -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; }; diff --git a/nixos/modules/services/backup/bacula.nix b/nixos/modules/services/backup/bacula.nix index cc8b77cbfbe..59890204234 100644 --- a/nixos/modules/services/backup/bacula.nix +++ b/nixos/modules/services/backup/bacula.nix @@ -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 diff --git a/nixos/modules/services/cluster/kubernetes/kubelet.nix b/nixos/modules/services/cluster/kubernetes/kubelet.nix index eb0cb1f3dbc..2806f73375b 100644 --- a/nixos/modules/services/cluster/kubernetes/kubelet.nix +++ b/nixos/modules/services/cluster/kubernetes/kubelet.nix @@ -168,6 +168,7 @@ in hostname = mkOption { description = "Kubernetes kubelet hostname override."; default = config.networking.hostName; + defaultText = literalExpression "config.networking.hostName"; type = str; }; diff --git a/nixos/modules/services/cluster/kubernetes/pki.nix b/nixos/modules/services/cluster/kubernetes/pki.nix index faf951d8157..76ab03cd520 100644 --- a/nixos/modules/services/cluster/kubernetes/pki.nix +++ b/nixos/modules/services/cluster/kubernetes/pki.nix @@ -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; }; diff --git a/nixos/modules/services/cluster/kubernetes/proxy.nix b/nixos/modules/services/cluster/kubernetes/proxy.nix index a92043d5259..a09efcef94e 100644 --- a/nixos/modules/services/cluster/kubernetes/proxy.nix +++ b/nixos/modules/services/cluster/kubernetes/proxy.nix @@ -37,6 +37,7 @@ in hostname = mkOption { description = "Kubernetes proxy hostname override."; default = config.networking.hostName; + defaultText = literalExpression "config.networking.hostName"; type = str; }; diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix index 0c96f323132..d2f3feffc97 100644 --- a/nixos/modules/services/computing/slurm/slurm.nix +++ b/nixos/modules/services/computing/slurm/slurm.nix @@ -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 slurmdbd is running (i.e. name returned by hostname -s). diff --git a/nixos/modules/services/continuous-integration/github-runner.nix b/nixos/modules/services/continuous-integration/github-runner.nix index 943c1e4598d..59370f43fe7 100644 --- a/nixos/modules/services/continuous-integration/github-runner.nix +++ b/nixos/modules/services/continuous-integration/github-runner.nix @@ -58,6 +58,7 @@ in ''; example = "nixos"; default = config.networking.hostName; + defaultText = literalExpression "config.networking.hostName"; }; runnerGroup = mkOption { diff --git a/nixos/modules/services/continuous-integration/hydra/default.nix b/nixos/modules/services/continuous-integration/hydra/default.nix index d6cde77c0a3..ccb7cc21734 100644 --- a/nixos/modules/services/continuous-integration/hydra/default.nix +++ b/nixos/modules/services/continuous-integration/hydra/default.nix @@ -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."; }; diff --git a/nixos/modules/services/logging/journalwatch.nix b/nixos/modules/services/logging/journalwatch.nix index 576c646c0f5..fb86904d1ea 100644 --- a/nixos/modules/services/logging/journalwatch.nix +++ b/nixos/modules/services/logging/journalwatch.nix @@ -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. ''; diff --git a/nixos/modules/services/logging/klogd.nix b/nixos/modules/services/logging/klogd.nix index 2d1f515da92..8d371c161eb 100644 --- a/nixos/modules/services/logging/klogd.nix +++ b/nixos/modules/services/logging/klogd.nix @@ -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 diff --git a/nixos/modules/services/mail/opendkim.nix b/nixos/modules/services/mail/opendkim.nix index beff57613af..f1ffc5d3aee 100644 --- a/nixos/modules/services/mail/opendkim.nix +++ b/nixos/modules/services/mail/opendkim.nix @@ -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 opendkim(8) for more information on datasets). diff --git a/nixos/modules/services/misc/etcd.nix b/nixos/modules/services/misc/etcd.nix index c4ea091a038..26ad1ad5536 100644 --- a/nixos/modules/services/misc/etcd.nix +++ b/nixos/modules/services/misc/etcd.nix @@ -17,6 +17,7 @@ in { name = mkOption { description = "Etcd unique node name."; default = config.networking.hostName; + defaultText = literalExpression "config.networking.hostName"; type = types.str; }; diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index b2abe70627d..01a7ea42d9d 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -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 { diff --git a/nixos/modules/services/misc/matrix-appservice-discord.nix b/nixos/modules/services/misc/matrix-appservice-discord.nix index c448614eca3..947471e56b4 100644 --- a/nixos/modules/services/misc/matrix-appservice-discord.nix +++ b/nixos/modules/services/misc/matrix-appservice-discord.nix @@ -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. diff --git a/nixos/modules/services/misc/matrix-synapse.nix b/nixos/modules/services/misc/matrix-synapse.nix index 950c72c6e58..0f96f6b1ee2 100644 --- a/nixos/modules/services/misc/matrix-synapse.nix +++ b/nixos/modules/services/misc/matrix-synapse.nix @@ -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. ''; diff --git a/nixos/modules/services/misc/mautrix-telegram.nix b/nixos/modules/services/misc/mautrix-telegram.nix index 59d0b682409..3b070b873b0 100644 --- a/nixos/modules/services/misc/mautrix-telegram.nix +++ b/nixos/modules/services/misc/mautrix-telegram.nix @@ -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. ''; diff --git a/nixos/modules/services/misc/moonraker.nix b/nixos/modules/services/misc/moonraker.nix index de8668a0c06..e08d2f84212 100644 --- a/nixos/modules/services/misc/moonraker.nix +++ b/nixos/modules/services/misc/moonraker.nix @@ -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."; }; diff --git a/nixos/modules/services/misc/mx-puppet-discord.nix b/nixos/modules/services/misc/mx-puppet-discord.nix index c34803f9722..a838af0da08 100644 --- a/nixos/modules/services/misc/mx-puppet-discord.nix +++ b/nixos/modules/services/misc/mx-puppet-discord.nix @@ -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. ''; diff --git a/nixos/modules/services/misc/sourcehut/default.nix b/nixos/modules/services/misc/sourcehut/default.nix index 9c812d6b043..c84a75b0ca0 100644 --- a/nixos/modules/services/misc/sourcehut/default.nix +++ b/nixos/modules/services/misc/sourcehut/default.nix @@ -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 ''; diff --git a/nixos/modules/services/misc/xmrig.nix b/nixos/modules/services/misc/xmrig.nix index cf01bb119e8..c5c3803920c 100644 --- a/nixos/modules/services/misc/xmrig.nix +++ b/nixos/modules/services/misc/xmrig.nix @@ -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."; }; diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index 4690a252c92..0dbb33530c9 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -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; }; diff --git a/nixos/modules/services/monitoring/nagios.nix b/nixos/modules/services/monitoring/nagios.nix index 83020d52fc8..2c7f0ed1966 100644 --- a/nixos/modules/services/monitoring/nagios.nix +++ b/nixos/modules/services/monitoring/nagios.nix @@ -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"; }; diff --git a/nixos/modules/services/monitoring/parsedmarc.nix b/nixos/modules/services/monitoring/parsedmarc.nix index eeee04b4400..8571e1f01ed 100644 --- a/nixos/modules/services/monitoring/parsedmarc.nix +++ b/nixos/modules/services/monitoring/parsedmarc.nix @@ -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. diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix index 3ea25437114..73021b1b4d3 100644 --- a/nixos/modules/services/monitoring/smartd.nix +++ b/nixos/modules/services/monitoring/smartd.nix @@ -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."; }; diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix index 36b72ca48b2..5482b2aaf88 100644 --- a/nixos/modules/services/network-filesystems/ipfs.nix +++ b/nixos/modules/services/network-filesystems/ipfs.nix @@ -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"; }; diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix index f2b2e4c4d5d..e44f8d4cf30 100644 --- a/nixos/modules/services/networking/bind.nix +++ b/nixos/modules/services/networking/bind.nix @@ -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. diff --git a/nixos/modules/services/networking/coturn.nix b/nixos/modules/services/networking/coturn.nix index 610754e9bd3..ce563c31136 100644 --- a/nixos/modules/services/networking/coturn.nix +++ b/nixos/modules/services/networking/coturn.nix @@ -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 diff --git a/nixos/modules/services/networking/dnscrypt-wrapper.nix b/nixos/modules/services/networking/dnscrypt-wrapper.nix index 400d6e67044..c2add170e9c 100644 --- a/nixos/modules/services/networking/dnscrypt-wrapper.nix +++ b/nixos/modules/services/networking/dnscrypt-wrapper.nix @@ -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. diff --git a/nixos/modules/services/networking/flannel.nix b/nixos/modules/services/networking/flannel.nix index b15339870ee..ac84b3d35a3 100644 --- a/nixos/modules/services/networking/flannel.nix +++ b/nixos/modules/services/networking/flannel.nix @@ -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"; }; diff --git a/nixos/modules/services/networking/ncdns.nix b/nixos/modules/services/networking/ncdns.nix index af17fc0814b..82c285d0516 100644 --- a/nixos/modules/services/networking/ncdns.nix +++ b/nixos/modules/services/networking/ncdns.nix @@ -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 diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix index 893995165b9..cf6c9661dc1 100644 --- a/nixos/modules/services/networking/nsd.nix +++ b/nixos/modules/services/networking/nsd.nix @@ -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 diff --git a/nixos/modules/services/networking/ntp/chrony.nix b/nixos/modules/services/networking/ntp/chrony.nix index d414936a2c2..34728455a21 100644 --- a/nixos/modules/services/networking/ntp/chrony.nix +++ b/nixos/modules/services/networking/ntp/chrony.nix @@ -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. diff --git a/nixos/modules/services/networking/ntp/ntpd.nix b/nixos/modules/services/networking/ntp/ntpd.nix index ce4802ce024..12be0d045a8 100644 --- a/nixos/modules/services/networking/ntp/ntpd.nix +++ b/nixos/modules/services/networking/ntp/ntpd.nix @@ -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. diff --git a/nixos/modules/services/networking/ntp/openntpd.nix b/nixos/modules/services/networking/ntp/openntpd.nix index 9f3892e3b53..e86b71291f9 100644 --- a/nixos/modules/services/networking/ntp/openntpd.nix +++ b/nixos/modules/services/networking/ntp/openntpd.nix @@ -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; }; diff --git a/nixos/modules/services/networking/resilio.nix b/nixos/modules/services/networking/resilio.nix index 4701b0e8143..89127850641 100644 --- a/nixos/modules/services/networking/resilio.nix +++ b/nixos/modules/services/networking/resilio.nix @@ -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. ''; diff --git a/nixos/modules/services/networking/seafile.nix b/nixos/modules/services/networking/seafile.nix index 856797b6b02..d7fb22edebe 100644 --- a/nixos/modules/services/networking/seafile.nix +++ b/nixos/modules/services/networking/seafile.nix @@ -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 { diff --git a/nixos/modules/services/networking/skydns.nix b/nixos/modules/services/networking/skydns.nix index c4e959b57bb..dea60a3862a 100644 --- a/nixos/modules/services/networking/skydns.nix +++ b/nixos/modules/services/networking/skydns.nix @@ -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"]; diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix index c075cbbceac..bd71b158dbe 100644 --- a/nixos/modules/services/networking/smokeping.nix +++ b/nixos/modules/services/networking/smokeping.nix @@ -241,6 +241,12 @@ in + FPing binary = ${config.security.wrapperDir}/fping ''; + defaultText = literalExpression '' + ''' + + FPing + binary = ''${config.security.wrapperDir}/fping + ''' + ''; description = "Probe configuration"; }; sendmail = mkOption { diff --git a/nixos/modules/services/networking/soju.nix b/nixos/modules/services/networking/soju.nix index 68a33e9dccb..cb0acf4765f 100644 --- a/nixos/modules/services/networking/soju.nix +++ b/nixos/modules/services/networking/soju.nix @@ -43,6 +43,7 @@ in hostName = mkOption { type = types.str; default = config.networking.hostName; + defaultText = literalExpression "config.networking.hostName"; description = "Server hostname."; }; diff --git a/nixos/modules/services/security/oauth2_proxy_nginx.nix b/nixos/modules/services/security/oauth2_proxy_nginx.nix index d82ddb894ea..5853c5a123c 100644 --- a/nixos/modules/services/security/oauth2_proxy_nginx.nix +++ b/nixos/modules/services/security/oauth2_proxy_nginx.nix @@ -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 ''; diff --git a/nixos/modules/services/security/torsocks.nix b/nixos/modules/services/security/torsocks.nix index 47ac95c4626..fdd6ac32cc6 100644 --- a/nixos/modules/services/security/torsocks.nix +++ b/nixos/modules/services/security/torsocks.nix @@ -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 /etc/tor/torsocks.conf containing the specified global torsocks configuration. diff --git a/nixos/modules/services/web-apps/ihatemoney/default.nix b/nixos/modules/services/web-apps/ihatemoney/default.nix index 238241854c1..ad314c885ba 100644 --- a/nixos/modules/services/web-apps/ihatemoney/default.nix +++ b/nixos/modules/services/web-apps/ihatemoney/default.nix @@ -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"; }; }; diff --git a/nixos/modules/services/web-apps/openwebrx.nix b/nixos/modules/services/web-apps/openwebrx.nix index 51005cd1e49..9e90c01e0bb 100644 --- a/nixos/modules/services/web-apps/openwebrx.nix +++ b/nixos/modules/services/web-apps/openwebrx.nix @@ -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"; }; }; diff --git a/nixos/modules/services/web-apps/peertube.nix b/nixos/modules/services/web-apps/peertube.nix index 362a3358b79..932ddcfef19 100644 --- a/nixos/modules/services/web-apps/peertube.nix +++ b/nixos/modules/services/web-apps/peertube.nix @@ -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."; }; }; diff --git a/nixos/modules/services/web-servers/varnish/default.nix b/nixos/modules/services/web-servers/varnish/default.nix index 0ebf58eb9f6..fe817313a99 100644 --- a/nixos/modules/services/web-servers/varnish/default.nix +++ b/nixos/modules/services/web-servers/varnish/default.nix @@ -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. "; diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index b04577aeb83..58377ea6443 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -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. diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index fa8500dd42b..8db271f8713 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -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. diff --git a/nixos/modules/system/boot/resolved.nix b/nixos/modules/system/boot/resolved.nix index a6fc07da0ab..21d3fab2f35 100644 --- a/nixos/modules/system/boot/resolved.nix +++ b/nixos/modules/system/boot/resolved.nix @@ -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 = '' diff --git a/nixos/modules/system/boot/timesyncd.nix b/nixos/modules/system/boot/timesyncd.nix index 692315dbe99..5f35a154769 100644 --- a/nixos/modules/system/boot/timesyncd.nix +++ b/nixos/modules/system/boot/timesyncd.nix @@ -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. diff --git a/nixos/modules/virtualisation/amazon-options.nix b/nixos/modules/virtualisation/amazon-options.nix index 698edcd835a..0465571ca92 100644 --- a/nixos/modules/virtualisation/amazon-options.nix +++ b/nixos/modules/virtualisation/amazon-options.nix @@ -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. diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 91356ac1d98..c7c3d747464 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -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 -- cgit 1.4.1 From 3e9c5fc8ca258d705d362689d614fbb8d53f177e Mon Sep 17 00:00:00 2001 From: pennae Date: Fri, 26 Nov 2021 01:16:07 +0100 Subject: nixos/*: escape config reference in examples and descriptions --- nixos/modules/services/games/factorio.nix | 4 ++-- nixos/modules/services/web-servers/uwsgi.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/games/factorio.nix b/nixos/modules/services/games/factorio.nix index 0e8860a0281..96fcd6d2c8b 100644 --- a/nixos/modules/services/games/factorio.nix +++ b/nixos/modules/services/games/factorio.nix @@ -75,8 +75,8 @@ in description = '' The name of the savegame that will be used by the server. - When not present in ${stateDir}/saves, a new map with default - settings will be generated before starting the service. + When not present in /var/lib/''${config.services.factorio.stateDirName}/saves, + a new map with default settings will be generated before starting the service. ''; }; # TODO Add more individual settings as nixos-options? diff --git a/nixos/modules/services/web-servers/uwsgi.nix b/nixos/modules/services/web-servers/uwsgi.nix index ac435951310..a1cad17336d 100644 --- a/nixos/modules/services/web-servers/uwsgi.nix +++ b/nixos/modules/services/web-servers/uwsgi.nix @@ -121,7 +121,7 @@ in { moin = { type = "normal"; pythonPackages = self: with self; [ moinmoin ]; - socket = "${config.services.uwsgi.runDir}/uwsgi.sock"; + socket = "''${config.services.uwsgi.runDir}/uwsgi.sock"; }; }; } -- cgit 1.4.1 From c694c35f9da13e7008b281d757385e6ad525e22a Mon Sep 17 00:00:00 2001 From: pennae Date: Fri, 26 Nov 2021 01:16:07 +0100 Subject: nixos/*: escape pkgs reference in examples and descriptions --- nixos/modules/services/audio/navidrome.nix | 2 +- nixos/modules/services/misc/gitea.nix | 2 +- nixos/modules/services/video/epgstation/default.nix | 2 +- nixos/modules/services/video/mirakurun.nix | 2 +- nixos/modules/system/activation/activation-script.nix | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nixos/modules/services/audio/navidrome.nix b/nixos/modules/services/audio/navidrome.nix index c2fe429f984..3660e05310b 100644 --- a/nixos/modules/services/audio/navidrome.nix +++ b/nixos/modules/services/audio/navidrome.nix @@ -9,7 +9,7 @@ in { options = { services.navidrome = { - enable = mkEnableOption pkgs.navidrome.meta.description; + enable = mkEnableOption "Navidrome music server"; settings = mkOption rec { type = settingsFormat.type; diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix index c0f7661c569..022a73c2b59 100644 --- a/nixos/modules/services/misc/gitea.nix +++ b/nixos/modules/services/misc/gitea.nix @@ -299,7 +299,7 @@ in ENABLED = true; MAILER_TYPE = "sendmail"; FROM = "do-not-reply@example.org"; - SENDMAIL_PATH = "${pkgs.system-sendmail}/bin/sendmail"; + SENDMAIL_PATH = "''${pkgs.system-sendmail}/bin/sendmail"; }; other = { SHOW_FOOTER_VERSION = false; diff --git a/nixos/modules/services/video/epgstation/default.nix b/nixos/modules/services/video/epgstation/default.nix index 36f7b937d5a..56bd9d9eeec 100644 --- a/nixos/modules/services/video/epgstation/default.nix +++ b/nixos/modules/services/video/epgstation/default.nix @@ -48,7 +48,7 @@ let in { options.services.epgstation = { - enable = mkEnableOption pkgs.epgstation.meta.description; + enable = mkEnableOption "EPGStation: DTV Software in Japan"; usePreconfiguredStreaming = mkOption { type = types.bool; diff --git a/nixos/modules/services/video/mirakurun.nix b/nixos/modules/services/video/mirakurun.nix index 16efb56cfd6..35303b2332c 100644 --- a/nixos/modules/services/video/mirakurun.nix +++ b/nixos/modules/services/video/mirakurun.nix @@ -24,7 +24,7 @@ in { options = { services.mirakurun = { - enable = mkEnableOption mirakurun.meta.description; + enable = mkEnableOption "the Mirakurun DVR Tuner Server"; port = mkOption { type = with types; nullOr port; diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix index 8dbfe393f10..4a32387db8d 100644 --- a/nixos/modules/system/activation/activation-script.nix +++ b/nixos/modules/system/activation/activation-script.nix @@ -150,7 +150,7 @@ in example = literalExpression '' { plasmaSetup = { text = ''' - ${pkgs.libsForQt5.kservice}/bin/kbuildsycoca5" + ''${pkgs.libsForQt5.kservice}/bin/kbuildsycoca5" '''; deps = []; }; -- cgit 1.4.1