diff --git a/lib/modules.nix b/lib/modules.nix
index e3bb27aa9462..573bf40e4b34 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -614,6 +614,8 @@ rec {
definitions = map (def: def.value) res.defsFinal;
files = map (def: def.file) res.defsFinal;
inherit (res) isDefined;
+ # This allows options to be correctly displayed using `${options.path.to.it}`
+ __toString = _: showOption loc;
};
# Merge definitions of a value of a given type.
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 11307e331200..133a150df82c 100644
--- a/nixos/modules/config/networking.nix
+++ b/nixos/modules/config/networking.nix
@@ -1,12 +1,13 @@
# /etc files related to networking, such as /etc/services.
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.networking;
+ opt = options.networking;
localhostMultiple = any (elem "localhost") (attrValues (removeAttrs cfg.hosts [ "127.0.0.1" "::1" ]));
@@ -78,6 +79,7 @@ in
httpProxy = lib.mkOption {
type = types.nullOr types.str;
default = cfg.proxy.default;
+ defaultText = literalExpression "config.${opt.proxy.default}";
description = ''
This option specifies the http_proxy environment variable.
'';
@@ -87,6 +89,7 @@ in
httpsProxy = lib.mkOption {
type = types.nullOr types.str;
default = cfg.proxy.default;
+ defaultText = literalExpression "config.${opt.proxy.default}";
description = ''
This option specifies the https_proxy environment variable.
'';
@@ -96,6 +99,7 @@ in
ftpProxy = lib.mkOption {
type = types.nullOr types.str;
default = cfg.proxy.default;
+ defaultText = literalExpression "config.${opt.proxy.default}";
description = ''
This option specifies the ftp_proxy environment variable.
'';
@@ -105,6 +109,7 @@ in
rsyncProxy = lib.mkOption {
type = types.nullOr types.str;
default = cfg.proxy.default;
+ defaultText = literalExpression "config.${opt.proxy.default}";
description = ''
This option specifies the rsync_proxy environment variable.
'';
@@ -114,6 +119,7 @@ in
allProxy = lib.mkOption {
type = types.nullOr types.str;
default = cfg.proxy.default;
+ defaultText = literalExpression "config.${opt.proxy.default}";
description = ''
This option specifies the all_proxy environment variable.
'';
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index 6ff4ec2921cf..875c4c9c4415 100644
--- a/nixos/modules/config/system-path.nix
+++ b/nixos/modules/config/system-path.nix
@@ -41,12 +41,17 @@ let
pkgs.zstd
];
- defaultPackages = map (pkg: setPrio ((pkg.meta.priority or 5) + 3) pkg)
- [ pkgs.nano
- pkgs.perl
- pkgs.rsync
- pkgs.strace
- ];
+ defaultPackageNames =
+ [ "nano"
+ "perl"
+ "rsync"
+ "strace"
+ ];
+ defaultPackages =
+ map
+ (n: let pkg = pkgs.${n}; in setPrio ((pkg.meta.priority or 5) + 3) pkg)
+ defaultPackageNames;
+ defaultPackagesText = "[ ${concatMapStringsSep " " (n: "pkgs.${n}") defaultPackageNames } ]";
in
@@ -73,6 +78,11 @@ in
defaultPackages = mkOption {
type = types.listOf types.package;
default = defaultPackages;
+ defaultText = literalDocBook ''
+ these packages, with their meta.priority numerically increased
+ (thus lowering their installation priority):
+ ${defaultPackagesText}
+ '';
example = [];
description = ''
Set of default packages that aren't strictly necessary
diff --git a/nixos/modules/hardware/system-76.nix b/nixos/modules/hardware/system-76.nix
index d4896541dbae..ca40ee0ebb37 100644
--- a/nixos/modules/hardware/system-76.nix
+++ b/nixos/modules/hardware/system-76.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
let
- inherit (lib) mkOption mkEnableOption types mkIf mkMerge optional versionOlder;
+ inherit (lib) literalExpression mkOption mkEnableOption types mkIf mkMerge optional versionOlder;
cfg = config.hardware.system76;
+ opt = options.hardware.system76;
kpkgs = config.boot.kernelPackages;
modules = [ "system76" "system76-io" ] ++ (optional (versionOlder kpkgs.kernel.version "5.5") "system76-acpi");
@@ -60,6 +61,7 @@ in {
firmware-daemon.enable = mkOption {
default = cfg.enableAll;
+ defaultText = literalExpression "config.${opt.enableAll}";
example = true;
description = "Whether to enable the system76 firmware daemon";
type = types.bool;
@@ -67,6 +69,7 @@ in {
kernel-modules.enable = mkOption {
default = cfg.enableAll;
+ defaultText = literalExpression "config.${opt.enableAll}";
example = true;
description = "Whether to make the system76 out-of-tree kernel modules available";
type = types.bool;
@@ -74,6 +77,7 @@ in {
power-daemon.enable = mkOption {
default = cfg.enableAll;
+ defaultText = literalExpression "config.${opt.enableAll}";
example = true;
description = "Whether to enable the system76 power daemon";
type = types.bool;
diff --git a/nixos/modules/misc/version.nix b/nixos/modules/misc/version.nix
index 8f246a9278b7..fc0d65d5148e 100644
--- a/nixos/modules/misc/version.nix
+++ b/nixos/modules/misc/version.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.system.nixos;
+ opt = options.system.nixos;
in
{
@@ -53,6 +54,7 @@ in
stateVersion = mkOption {
type = types.str;
default = cfg.release;
+ defaultText = literalExpression "config.${opt.release}";
description = ''
Every once in a while, a new NixOS release may change
configuration defaults in a way incompatible with stateful
diff --git a/nixos/modules/programs/captive-browser.nix b/nixos/modules/programs/captive-browser.nix
index 0f5d087e8d87..dc054504ea48 100644
--- a/nixos/modules/programs/captive-browser.nix
+++ b/nixos/modules/programs/captive-browser.nix
@@ -3,6 +3,18 @@
with lib;
let
cfg = config.programs.captive-browser;
+ browserDefault = chromium: concatStringsSep " " [
+ ''env XDG_CONFIG_HOME="$PREV_CONFIG_HOME"''
+ ''${chromium}/bin/chromium''
+ ''--user-data-dir=''${XDG_DATA_HOME:-$HOME/.local/share}/chromium-captive''
+ ''--proxy-server="socks5://$PROXY"''
+ ''--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost"''
+ ''--no-first-run''
+ ''--new-window''
+ ''--incognito''
+ ''-no-default-browser-check''
+ ''http://cache.nixos.org/''
+ ];
in
{
###### interface
@@ -26,18 +38,8 @@ in
# the options below are the same as in "captive-browser.toml"
browser = mkOption {
type = types.str;
- default = concatStringsSep " " [
- ''env XDG_CONFIG_HOME="$PREV_CONFIG_HOME"''
- ''${pkgs.chromium}/bin/chromium''
- ''--user-data-dir=''${XDG_DATA_HOME:-$HOME/.local/share}/chromium-captive''
- ''--proxy-server="socks5://$PROXY"''
- ''--host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost"''
- ''--no-first-run''
- ''--new-window''
- ''--incognito''
- ''-no-default-browser-check''
- ''http://cache.nixos.org/''
- ];
+ default = browserDefault pkgs.chromium;
+ defaultText = literalExpression (browserDefault "\${pkgs.chromium}");
description = ''
The shell (/bin/sh) command executed once the proxy starts.
When browser exits, the proxy exits. An extra env var PROXY is available.
diff --git a/nixos/modules/programs/gnupg.nix b/nixos/modules/programs/gnupg.nix
index 06f49182e4df..fe5d7bd834b2 100644
--- a/nixos/modules/programs/gnupg.nix
+++ b/nixos/modules/programs/gnupg.nix
@@ -71,6 +71,7 @@ in
type = types.nullOr (types.enum pkgs.pinentry.flavors);
example = "gnome3";
default = defaultPinentryFlavor;
+ defaultText = literalDocBook ''matching the configured desktop environment'';
description = ''
Which pinentry interface to use. If not null, the path to the
pinentry binary will be passed to gpg-agent via commandline and
diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix
index e5c5b08f8d4d..5fe98b6801bb 100644
--- a/nixos/modules/programs/zsh/zsh.nix
+++ b/nixos/modules/programs/zsh/zsh.nix
@@ -1,6 +1,6 @@
# This module defines global configuration for the zshell.
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
@@ -9,6 +9,7 @@ let
cfge = config.environment;
cfg = config.programs.zsh;
+ opt = options.programs.zsh;
zshAliases = concatStringsSep "\n" (
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}")
@@ -147,6 +148,7 @@ in
enableGlobalCompInit = mkOption {
default = cfg.enableCompletion;
+ defaultText = literalExpression "config.${opt.enableCompletion}";
description = ''
Enable execution of compinit call for all interactive zsh shells.
diff --git a/nixos/modules/security/acme.nix b/nixos/modules/security/acme.nix
index b50eeddfa40a..dcadbce68aa4 100644
--- a/nixos/modules/security/acme.nix
+++ b/nixos/modules/security/acme.nix
@@ -2,6 +2,7 @@
with lib;
let
cfg = config.security.acme;
+ opt = options.security.acme;
# Used to calculate timer accuracy for coalescing
numCerts = length (builtins.attrNames cfg.certs);
@@ -485,6 +486,7 @@ let
email = mkOption {
type = types.nullOr types.str;
default = cfg.email;
+ defaultText = literalExpression "config.${opt.email}";
description = "Contact email address for the CA to be able to reach you.";
};
diff --git a/nixos/modules/security/dhparams.nix b/nixos/modules/security/dhparams.nix
index 012be2887d89..cfa9003f12fb 100644
--- a/nixos/modules/security/dhparams.nix
+++ b/nixos/modules/security/dhparams.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
let
- inherit (lib) mkOption types;
+ inherit (lib) literalExpression mkOption types;
cfg = config.security.dhparams;
+ opt = options.security.dhparams;
bitType = types.addCheck types.int (b: b >= 16) // {
name = "bits";
@@ -13,6 +14,7 @@ let
options.bits = mkOption {
type = bitType;
default = cfg.defaultBitSize;
+ defaultText = literalExpression "config.${opt.defaultBitSize}";
description = ''
The bit size for the prime that is used during a Diffie-Hellman
key exchange.
diff --git a/nixos/modules/services/audio/mpdscribble.nix b/nixos/modules/services/audio/mpdscribble.nix
index 1368543ae1a4..333ffb709410 100644
--- a/nixos/modules/services/audio/mpdscribble.nix
+++ b/nixos/modules/services/audio/mpdscribble.nix
@@ -1,10 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.mpdscribble;
mpdCfg = config.services.mpd;
+ mpdOpt = options.services.mpd;
endpointUrls = {
"last.fm" = "http://post.audioscrobbler.com";
@@ -108,6 +109,11 @@ in {
mpdCfg.network.listenAddress
else
"localhost");
+ defaultText = literalExpression ''
+ if config.${mpdOpt.network.listenAddress} != "any"
+ then config.${mpdOpt.network.listenAddress}
+ else "localhost"
+ '';
type = types.str;
description = ''
Host for the mpdscribble daemon to search for a mpd daemon on.
@@ -122,6 +128,10 @@ in {
mpdCfg.credentials).passwordFile
else
null;
+ defaultText = literalDocBook ''
+ The first password file with read access configured for MPD when using a local instance,
+ otherwise null.
+ '';
type = types.nullOr types.str;
description = ''
File containing the password for the mpd daemon.
@@ -132,6 +142,7 @@ in {
port = mkOption {
default = mpdCfg.network.port;
+ defaultText = literalExpression "config.${mpdOpt.network.port}";
type = types.port;
description = ''
Port for the mpdscribble daemon to search for a mpd daemon on.
diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix
index c75df45871ff..9b5fd90012e0 100644
--- a/nixos/modules/services/backup/tarsnap.nix
+++ b/nixos/modules/services/backup/tarsnap.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, utils, ... }:
+{ config, lib, options, pkgs, utils, ... }:
with lib;
let
gcfg = config.services.tarsnap;
+ opt = options.services.tarsnap;
configFile = name: cfg: ''
keyfile ${cfg.keyfile}
@@ -59,12 +60,13 @@ in
};
archives = mkOption {
- type = types.attrsOf (types.submodule ({ config, ... }:
+ type = types.attrsOf (types.submodule ({ config, options, ... }:
{
options = {
keyfile = mkOption {
type = types.str;
default = gcfg.keyfile;
+ defaultText = literalExpression "config.${opt.keyfile}";
description = ''
Set a specific keyfile for this archive. This defaults to
"/root/tarsnap.key" if left unspecified.
@@ -87,6 +89,9 @@ in
cachedir = mkOption {
type = types.nullOr types.path;
default = "/var/cache/tarsnap/${utils.escapeSystemdPath config.keyfile}";
+ defaultText = literalExpression ''
+ "/var/cache/tarsnap/''${utils.escapeSystemdPath config.${options.keyfile}}"
+ '';
description = ''
The cache allows tarsnap to identify previously stored data
blocks, reducing archival time and bandwidth usage.
diff --git a/nixos/modules/services/cluster/hadoop/default.nix b/nixos/modules/services/cluster/hadoop/default.nix
index 90f22c48e055..a1a95fe31cac 100644
--- a/nixos/modules/services/cluster/hadoop/default.nix
+++ b/nixos/modules/services/cluster/hadoop/default.nix
@@ -1,6 +1,7 @@
-{ config, lib, pkgs, ...}:
+{ config, lib, options, pkgs, ...}:
let
cfg = config.services.hadoop;
+ opt = options.services.hadoop;
in
with lib;
{
@@ -44,6 +45,14 @@ with lib;
"mapreduce.map.env" = "HADOOP_MAPRED_HOME=${cfg.package}/lib/${cfg.package.untarDir}";
"mapreduce.reduce.env" = "HADOOP_MAPRED_HOME=${cfg.package}/lib/${cfg.package.untarDir}";
};
+ defaultText = literalExpression ''
+ {
+ "mapreduce.framework.name" = "yarn";
+ "yarn.app.mapreduce.am.env" = "HADOOP_MAPRED_HOME=''${config.${opt.package}}/lib/''${config.${opt.package}.untarDir}";
+ "mapreduce.map.env" = "HADOOP_MAPRED_HOME=''${config.${opt.package}}/lib/''${config.${opt.package}.untarDir}";
+ "mapreduce.reduce.env" = "HADOOP_MAPRED_HOME=''${config.${opt.package}}/lib/''${config.${opt.package}.untarDir}";
+ }
+ '';
type = types.attrsOf types.anything;
example = literalExpression ''
options.services.hadoop.mapredSite.default // {
@@ -98,6 +107,9 @@ with lib;
log4jProperties = mkOption {
default = "${cfg.package}/lib/${cfg.package.untarDir}/etc/hadoop/log4j.properties";
+ defaultText = literalExpression ''
+ "''${config.${opt.package}}/lib/''${config.${opt.package}.untarDir}/etc/hadoop/log4j.properties"
+ '';
type = types.path;
example = literalExpression ''
"''${pkgs.hadoop}/lib/''${pkgs.hadoop.untarDir}/etc/hadoop/log4j.properties";
diff --git a/nixos/modules/services/cluster/kubernetes/addons/dashboard.nix b/nixos/modules/services/cluster/kubernetes/addons/dashboard.nix
index 2ed7742eda09..54b1f3859fcb 100644
--- a/nixos/modules/services/cluster/kubernetes/addons/dashboard.nix
+++ b/nixos/modules/services/cluster/kubernetes/addons/dashboard.nix
@@ -1,9 +1,10 @@
-{ config, pkgs, lib, ... }:
+{ config, options, pkgs, lib, ... }:
with lib;
let
cfg = config.services.kubernetes.addons.dashboard;
+ opt = options.services.kubernetes.addons.dashboard;
in {
imports = [
(mkRenamedOptionModule [ "services" "kubernetes" "addons" "dashboard" "enableRBAC" ] [ "services" "kubernetes" "addons" "dashboard" "rbac" "enable" ])
@@ -28,6 +29,9 @@ in {
description = "Whether to enable role based access control is enabled for kubernetes dashboard";
type = types.bool;
default = elem "RBAC" config.services.kubernetes.apiserver.authorizationMode;
+ defaultText = literalExpression ''
+ elem "RBAC" config.${options.services.kubernetes.apiserver.authorizationMode}
+ '';
};
clusterAdmin = mkOption {
@@ -54,6 +58,14 @@ in {
finalImageTag = cfg.version;
sha256 = "01xrr4pwgr2hcjrjsi3d14ifpzdfbxzqpzxbk2fkbjb9zkv38zxy";
};
+ defaultText = literalExpression ''
+ {
+ imageName = "k8s.gcr.io/kubernetes-dashboard-amd64";
+ imageDigest = "sha256:0ae6b69432e78069c5ce2bcde0fe409c5c4d6f0f4d9cd50a17974fea38898747";
+ finalImageTag = config.${opt.version};
+ sha256 = "01xrr4pwgr2hcjrjsi3d14ifpzdfbxzqpzxbk2fkbjb9zkv38zxy";
+ };
+ '';
};
};
diff --git a/nixos/modules/services/cluster/kubernetes/addons/dns.nix b/nixos/modules/services/cluster/kubernetes/addons/dns.nix
index 34943fddd3d1..10f45db7883f 100644
--- a/nixos/modules/services/cluster/kubernetes/addons/dns.nix
+++ b/nixos/modules/services/cluster/kubernetes/addons/dns.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, lib, ... }:
+{ config, options, pkgs, lib, ... }:
with lib;
@@ -23,6 +23,10 @@ in {
take 3 (splitString "." config.services.kubernetes.apiserver.serviceClusterIpRange
))
) + ".254";
+ defaultText = literalDocBook ''
+ The x.y.z.254 IP of
+ config.${options.services.kubernetes.apiserver.serviceClusterIpRange}.
+ '';
type = types.str;
};
diff --git a/nixos/modules/services/cluster/kubernetes/apiserver.nix b/nixos/modules/services/cluster/kubernetes/apiserver.nix
index 2c89310beb5a..5b97c571d763 100644
--- a/nixos/modules/services/cluster/kubernetes/apiserver.nix
+++ b/nixos/modules/services/cluster/kubernetes/apiserver.nix
@@ -1,9 +1,10 @@
- { config, lib, pkgs, ... }:
+ { config, lib, options, pkgs, ... }:
with lib;
let
top = config.services.kubernetes;
+ otop = options.services.kubernetes;
cfg = top.apiserver;
isRBACEnabled = elem "RBAC" cfg.authorizationMode;
@@ -84,6 +85,7 @@ in
clientCaFile = mkOption {
description = "Kubernetes apiserver CA file for client auth.";
default = top.caFile;
+ defaultText = literalExpression "config.${otop.caFile}";
type = nullOr path;
};
@@ -138,6 +140,7 @@ in
caFile = mkOption {
description = "Etcd ca file.";
default = top.caFile;
+ defaultText = literalExpression "config.${otop.caFile}";
type = types.nullOr types.path;
};
};
@@ -157,6 +160,7 @@ in
featureGates = mkOption {
description = "List set of feature gates";
default = top.featureGates;
+ defaultText = literalExpression "config.${otop.featureGates}";
type = listOf str;
};
@@ -175,6 +179,7 @@ in
kubeletClientCaFile = mkOption {
description = "Path to a cert file for connecting to kubelet.";
default = top.caFile;
+ defaultText = literalExpression "config.${otop.caFile}";
type = nullOr path;
};
diff --git a/nixos/modules/services/cluster/kubernetes/controller-manager.nix b/nixos/modules/services/cluster/kubernetes/controller-manager.nix
index 7128b5f70b1a..ed25715fab7d 100644
--- a/nixos/modules/services/cluster/kubernetes/controller-manager.nix
+++ b/nixos/modules/services/cluster/kubernetes/controller-manager.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
top = config.services.kubernetes;
+ otop = options.services.kubernetes;
cfg = top.controllerManager;
in
{
@@ -30,6 +31,7 @@ in
clusterCidr = mkOption {
description = "Kubernetes CIDR Range for Pods in cluster.";
default = top.clusterCidr;
+ defaultText = literalExpression "config.${otop.clusterCidr}";
type = str;
};
@@ -44,6 +46,7 @@ in
featureGates = mkOption {
description = "List set of feature gates";
default = top.featureGates;
+ defaultText = literalExpression "config.${otop.featureGates}";
type = listOf str;
};
@@ -67,6 +70,7 @@ in
service account's token secret.
'';
default = top.caFile;
+ defaultText = literalExpression "config.${otop.caFile}";
type = nullOr path;
};
diff --git a/nixos/modules/services/cluster/kubernetes/default.nix b/nixos/modules/services/cluster/kubernetes/default.nix
index 433adf4d488c..cf7fcb0a6d73 100644
--- a/nixos/modules/services/cluster/kubernetes/default.nix
+++ b/nixos/modules/services/cluster/kubernetes/default.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.kubernetes;
+ opt = options.services.kubernetes;
defaultContainerdSettings = {
version = 2;
@@ -87,6 +88,7 @@ let
description = "${prefix} certificate authority file used to connect to kube-apiserver.";
type = types.nullOr types.path;
default = cfg.caFile;
+ defaultText = literalExpression "config.${opt.caFile}";
};
certFile = mkOption {
diff --git a/nixos/modules/services/cluster/kubernetes/kubelet.nix b/nixos/modules/services/cluster/kubernetes/kubelet.nix
index 2806f73375bc..3e8eac96f6ba 100644
--- a/nixos/modules/services/cluster/kubernetes/kubelet.nix
+++ b/nixos/modules/services/cluster/kubernetes/kubelet.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
top = config.services.kubernetes;
+ otop = options.services.kubernetes;
cfg = top.kubelet;
cniConfig =
@@ -35,6 +36,7 @@ let
key = mkOption {
description = "Key of taint.";
default = name;
+ defaultText = literalDocBook "Name of this submodule.";
type = str;
};
value = mkOption {
@@ -76,12 +78,14 @@ in
clusterDomain = mkOption {
description = "Use alternative domain.";
default = config.services.kubernetes.addons.dns.clusterDomain;
+ defaultText = literalExpression "config.${options.services.kubernetes.addons.dns.clusterDomain}";
type = str;
};
clientCaFile = mkOption {
description = "Kubernetes apiserver CA file for client authentication.";
default = top.caFile;
+ defaultText = literalExpression "config.${otop.caFile}";
type = nullOr path;
};
@@ -148,6 +152,7 @@ in
featureGates = mkOption {
description = "List set of feature gates";
default = top.featureGates;
+ defaultText = literalExpression "config.${otop.featureGates}";
type = listOf str;
};
diff --git a/nixos/modules/services/cluster/kubernetes/proxy.nix b/nixos/modules/services/cluster/kubernetes/proxy.nix
index a09efcef94ea..5f3da034120b 100644
--- a/nixos/modules/services/cluster/kubernetes/proxy.nix
+++ b/nixos/modules/services/cluster/kubernetes/proxy.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
top = config.services.kubernetes;
+ otop = options.services.kubernetes;
cfg = top.proxy;
in
{
@@ -31,6 +32,7 @@ in
featureGates = mkOption {
description = "List set of feature gates";
default = top.featureGates;
+ defaultText = literalExpression "config.${otop.featureGates}";
type = listOf str;
};
diff --git a/nixos/modules/services/cluster/kubernetes/scheduler.nix b/nixos/modules/services/cluster/kubernetes/scheduler.nix
index 1b0c22a11426..87263ee72fa4 100644
--- a/nixos/modules/services/cluster/kubernetes/scheduler.nix
+++ b/nixos/modules/services/cluster/kubernetes/scheduler.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
top = config.services.kubernetes;
+ otop = options.services.kubernetes;
cfg = top.scheduler;
in
{
@@ -27,6 +28,7 @@ in
featureGates = mkOption {
description = "List set of feature gates";
default = top.featureGates;
+ defaultText = literalExpression "config.${otop.featureGates}";
type = listOf str;
};
diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix
index d2f3feffc970..7686ff99bfc0 100644
--- a/nixos/modules/services/computing/slurm/slurm.nix
+++ b/nixos/modules/services/computing/slurm/slurm.nix
@@ -1,10 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.slurm;
+ opt = options.services.slurm;
# configuration file can be generated by http://slurm.schedmd.com/configurator.html
defaultUser = "slurm";
@@ -90,6 +91,7 @@ in
storageUser = mkOption {
type = types.str;
default = cfg.user;
+ defaultText = literalExpression "config.${opt.user}";
description = ''
Database user name.
'';
@@ -154,6 +156,7 @@ in
controlAddr = mkOption {
type = types.nullOr types.str;
default = cfg.controlMachine;
+ defaultText = literalExpression "config.${opt.controlMachine}";
example = null;
description = ''
Name that ControlMachine should be referred to in establishing a
@@ -279,6 +282,10 @@ in
type = types.path;
internal = true;
default = etcSlurm;
+ defaultText = literalDocBook ''
+ Directory created from generated config files and
+ config.${opt.extraConfigPaths}.
+ '';
description = ''
Path to directory with slurm config files. This option is set by default from the
Slurm module and is meant to make the Slurm config file available to other modules.
diff --git a/nixos/modules/services/continuous-integration/buildbot/master.nix b/nixos/modules/services/continuous-integration/buildbot/master.nix
index 2dc61c21ac71..aaa159d3cb18 100644
--- a/nixos/modules/services/continuous-integration/buildbot/master.nix
+++ b/nixos/modules/services/continuous-integration/buildbot/master.nix
@@ -1,11 +1,12 @@
# NixOS module for Buildbot continous integration server.
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.buildbot-master;
+ opt = options.services.buildbot-master;
python = cfg.package.pythonModule;
@@ -152,6 +153,7 @@ in {
buildbotDir = mkOption {
default = "${cfg.home}/master";
+ defaultText = literalExpression ''"''${config.${opt.home}}/master"'';
type = types.path;
description = "Specifies the Buildbot directory.";
};
diff --git a/nixos/modules/services/continuous-integration/buildbot/worker.nix b/nixos/modules/services/continuous-integration/buildbot/worker.nix
index dd4f4a4a74a9..1d7f53bb6559 100644
--- a/nixos/modules/services/continuous-integration/buildbot/worker.nix
+++ b/nixos/modules/services/continuous-integration/buildbot/worker.nix
@@ -1,11 +1,12 @@
# NixOS module for Buildbot Worker.
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.buildbot-worker;
+ opt = options.services.buildbot-worker;
python = cfg.package.pythonModule;
@@ -77,6 +78,7 @@ in {
buildbotDir = mkOption {
default = "${cfg.home}/worker";
+ defaultText = literalExpression ''"''${config.${opt.home}}/worker"'';
type = types.path;
description = "Specifies the Buildbot directory.";
};
diff --git a/nixos/modules/services/continuous-integration/gocd-agent/default.nix b/nixos/modules/services/continuous-integration/gocd-agent/default.nix
index acc3fb12484a..c63998c6736a 100644
--- a/nixos/modules/services/continuous-integration/gocd-agent/default.nix
+++ b/nixos/modules/services/continuous-integration/gocd-agent/default.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.gocd-agent;
+ opt = options.services.gocd-agent;
in {
options = {
services.gocd-agent = {
@@ -98,6 +99,15 @@ in {
"-Dcruise.console.publish.interval=10"
"-Djava.security.egd=file:/dev/./urandom"
];
+ defaultText = literalExpression ''
+ [
+ "-Xms''${config.${opt.initialJavaHeapSize}}"
+ "-Xmx''${config.${opt.maxJavaHeapMemory}}"
+ "-Djava.io.tmpdir=/tmp"
+ "-Dcruise.console.publish.interval=10"
+ "-Djava.security.egd=file:/dev/./urandom"
+ ]
+ '';
description = ''
Specifies startup command line arguments to pass to Go.CD agent
java process.
diff --git a/nixos/modules/services/continuous-integration/gocd-server/default.nix b/nixos/modules/services/continuous-integration/gocd-server/default.nix
index 646bf13ac67a..3540656f9344 100644
--- a/nixos/modules/services/continuous-integration/gocd-server/default.nix
+++ b/nixos/modules/services/continuous-integration/gocd-server/default.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.gocd-server;
+ opt = options.services.gocd-server;
in {
options = {
services.gocd-server = {
@@ -106,6 +107,20 @@ in {
"-Dcruise.server.port=${toString cfg.port}"
"-Dcruise.server.ssl.port=${toString cfg.sslPort}"
];
+ defaultText = literalExpression ''
+ [
+ "-Xms''${config.${opt.initialJavaHeapSize}}"
+ "-Xmx''${config.${opt.maxJavaHeapMemory}}"
+ "-Dcruise.listen.host=''${config.${opt.listenAddress}}"
+ "-Duser.language=en"
+ "-Djruby.rack.request.size.threshold.bytes=30000000"
+ "-Duser.country=US"
+ "-Dcruise.config.dir=''${config.${opt.workDir}}/conf"
+ "-Dcruise.config.file=''${config.${opt.workDir}}/conf/cruise-config.xml"
+ "-Dcruise.server.port=''${toString config.${opt.port}}"
+ "-Dcruise.server.ssl.port=''${toString config.${opt.sslPort}}"
+ ]
+ '';
description = ''
Specifies startup command line arguments to pass to Go.CD server
diff --git a/nixos/modules/services/databases/hbase.nix b/nixos/modules/services/databases/hbase.nix
index 181be2d6b0b8..fe4f05eec643 100644
--- a/nixos/modules/services/databases/hbase.nix
+++ b/nixos/modules/services/databases/hbase.nix
@@ -1,14 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.services.hbase;
-
- defaultConfig = {
- "hbase.rootdir" = "file://${cfg.dataDir}/hbase";
- "hbase.zookeeper.property.dataDir" = "${cfg.dataDir}/zookeeper";
- };
+ opt = options.services.hbase;
buildProperty = configAttr:
(builtins.concatStringsSep "\n"
@@ -23,7 +19,7 @@ let
configFile = pkgs.writeText "hbase-site.xml"
''
- ${buildProperty (defaultConfig // cfg.settings)}
+ ${buildProperty (opt.settings.default // cfg.settings)}
'';
@@ -96,7 +92,16 @@ in {
settings = mkOption {
type = with lib.types; attrsOf (oneOf [ str int bool ]);
- default = defaultConfig;
+ default = {
+ "hbase.rootdir" = "file://${cfg.dataDir}/hbase";
+ "hbase.zookeeper.property.dataDir" = "${cfg.dataDir}/zookeeper";
+ };
+ defaultText = literalExpression ''
+ {
+ "hbase.rootdir" = "file://''${config.${opt.dataDir}}/hbase";
+ "hbase.zookeeper.property.dataDir" = "''${config.${opt.dataDir}}/zookeeper";
+ }
+ '';
description = ''
configurations in hbase-site.xml, see for details.
'';
diff --git a/nixos/modules/services/databases/neo4j.nix b/nixos/modules/services/databases/neo4j.nix
index f37e5ad16939..8816f3b2e4b6 100644
--- a/nixos/modules/services/databases/neo4j.nix
+++ b/nixos/modules/services/databases/neo4j.nix
@@ -4,6 +4,7 @@ with lib;
let
cfg = config.services.neo4j;
+ opt = options.services.neo4j;
certDirOpt = options.services.neo4j.directories.certificates;
isDefaultPathOption = opt: isOption opt && opt.type == types.path && opt.highestPrio >= 1500;
@@ -256,6 +257,7 @@ in {
certificates = mkOption {
type = types.path;
default = "${cfg.directories.home}/certificates";
+ defaultText = literalExpression ''"''${config.${opt.directories.home}}/certificates"'';
description = ''
Directory for storing certificates to be used by Neo4j for
TLS connections.
@@ -280,6 +282,7 @@ in {
data = mkOption {
type = types.path;
default = "${cfg.directories.home}/data";
+ defaultText = literalExpression ''"''${config.${opt.directories.home}}/data"'';
description = ''
Path of the data directory. You must not configure more than one
Neo4j installation to use the same data directory.
@@ -305,6 +308,7 @@ in {
imports = mkOption {
type = types.path;
default = "${cfg.directories.home}/import";
+ defaultText = literalExpression ''"''${config.${opt.directories.home}}/import"'';
description = ''
The root directory for file URLs used with the Cypher
LOAD CSV clause. Only meaningful when
@@ -321,6 +325,7 @@ in {
plugins = mkOption {
type = types.path;
default = "${cfg.directories.home}/plugins";
+ defaultText = literalExpression ''"''${config.${opt.directories.home}}/plugins"'';
description = ''
Path of the database plugin directory. Compiled Java JAR files that
contain database procedures will be loaded if they are placed in
@@ -432,6 +437,7 @@ in {
baseDirectory = mkOption {
type = types.path;
default = "${cfg.directories.certificates}/${name}";
+ defaultText = literalExpression ''"''${config.${opt.directories.certificates}}/''${name}"'';
description = ''
The mandatory base directory for cryptographic objects of this
policy. This path is only automatically generated when this
@@ -493,6 +499,7 @@ in {
revokedDir = mkOption {
type = types.path;
default = "${config.baseDirectory}/revoked";
+ defaultText = literalExpression ''"''${config.${options.baseDirectory}}/revoked"'';
description = ''
Path to directory of CRLs (Certificate Revocation Lists) in
PEM format. Must be an absolute path. The existence of this
@@ -528,6 +535,7 @@ in {
trustedDir = mkOption {
type = types.path;
default = "${config.baseDirectory}/trusted";
+ defaultText = literalExpression ''"''${config.${options.baseDirectory}}/trusted"'';
description = ''
Path to directory of X.509 certificates in PEM format for
trusted parties. Must be an absolute path. The existence of this
diff --git a/nixos/modules/services/games/quake3-server.nix b/nixos/modules/services/games/quake3-server.nix
index 1dc01260e8fa..175af4a83828 100644
--- a/nixos/modules/services/games/quake3-server.nix
+++ b/nixos/modules/services/games/quake3-server.nix
@@ -71,6 +71,7 @@ in {
baseq3 = mkOption {
type = types.either types.package types.path;
default = defaultBaseq3;
+ defaultText = literalDocBook "Manually downloaded Quake 3 installation directory.";
example = "/var/lib/q3ds";
description = ''
Path to the baseq3 files (pak*.pk3). If this is on the nix store (type = package) all .pk3 files should be saved
diff --git a/nixos/modules/services/games/terraria.nix b/nixos/modules/services/games/terraria.nix
index 7312c7e6b635..29f976b3c2ae 100644
--- a/nixos/modules/services/games/terraria.nix
+++ b/nixos/modules/services/games/terraria.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.terraria;
+ opt = options.services.terraria;
worldSizeMap = { small = 1; medium = 2; large = 3; };
valFlag = name: val: optionalString (val != null) "-${name} \"${escape ["\\" "\""] (toString val)}\"";
boolFlag = name: val: optionalString val "-${name}";
@@ -36,7 +37,7 @@ in
type = types.bool;
default = false;
description = ''
- If enabled, starts a Terraria server. The server can be connected to via tmux -S ${cfg.dataDir}/terraria.sock attach
+ If enabled, starts a Terraria server. The server can be connected to via tmux -S ''${config.${opt.dataDir}}/terraria.sock attach
for administration by users who are a part of the terraria group (use C-b d shortcut to detach again).
'';
};
diff --git a/nixos/modules/services/hardware/tcsd.nix b/nixos/modules/services/hardware/tcsd.nix
index c549a6775013..e414b9647c9b 100644
--- a/nixos/modules/services/hardware/tcsd.nix
+++ b/nixos/modules/services/hardware/tcsd.nix
@@ -1,11 +1,12 @@
# tcsd daemon.
-{ config, pkgs, lib, ... }:
+{ config, options, pkgs, lib, ... }:
with lib;
let
cfg = config.services.tcsd;
+ opt = options.services.tcsd;
tcsdConf = pkgs.writeText "tcsd.conf" ''
port = 30003
@@ -83,6 +84,7 @@ in
platformCred = mkOption {
default = "${cfg.stateDir}/platform.cert";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/platform.cert"'';
type = types.path;
description = ''
Path to the platform credential for your TPM. Your TPM
@@ -96,6 +98,7 @@ in
conformanceCred = mkOption {
default = "${cfg.stateDir}/conformance.cert";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/conformance.cert"'';
type = types.path;
description = ''
Path to the conformance credential for your TPM.
@@ -104,6 +107,7 @@ in
endorsementCred = mkOption {
default = "${cfg.stateDir}/endorsement.cert";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/endorsement.cert"'';
type = types.path;
description = ''
Path to the endorsement credential for your TPM.
diff --git a/nixos/modules/services/logging/journalbeat.nix b/nixos/modules/services/logging/journalbeat.nix
index 48b02142cb4c..4035ab48b4b8 100644
--- a/nixos/modules/services/logging/journalbeat.nix
+++ b/nixos/modules/services/logging/journalbeat.nix
@@ -5,14 +5,10 @@ with lib;
let
cfg = config.services.journalbeat;
- lt6 = builtins.compareVersions cfg.package.version "6" < 0;
-
journalbeatYml = pkgs.writeText "journalbeat.yml" ''
name: ${cfg.name}
tags: ${builtins.toJSON cfg.tags}
- ${optionalString lt6 "journalbeat.cursor_state_file: /var/lib/${cfg.stateDir}/cursor-state"}
-
${cfg.extraConfig}
'';
@@ -57,17 +53,7 @@ in
extraConfig = mkOption {
type = types.lines;
- default = optionalString lt6 ''
- journalbeat:
- seek_position: cursor
- cursor_seek_fallback: tail
- write_cursor_state: true
- cursor_flush_period: 5s
- clean_field_names: true
- convert_to_numbers: false
- move_metadata_to_field: journal
- default_type: journal
- '';
+ default = "";
description = "Any other configuration options you want to add";
};
diff --git a/nixos/modules/services/mail/rspamd.nix b/nixos/modules/services/mail/rspamd.nix
index 50208cbeb00a..a570e137a55a 100644
--- a/nixos/modules/services/mail/rspamd.nix
+++ b/nixos/modules/services/mail/rspamd.nix
@@ -5,6 +5,7 @@ with lib;
let
cfg = config.services.rspamd;
+ opt = options.services.rspamd;
postfixCfg = config.services.postfix;
bindSocketOpts = {options, config, ... }: {
@@ -285,8 +286,8 @@ in
bindSockets = [{
socket = "/run/rspamd/rspamd.sock";
mode = "0660";
- owner = "${cfg.user}";
- group = "${cfg.group}";
+ owner = "''${config.${opt.user}}";
+ group = "''${config.${opt.group}}";
}];
};
controller = {
diff --git a/nixos/modules/services/misc/airsonic.nix b/nixos/modules/services/misc/airsonic.nix
index 533a3d367a32..5a5c30a41233 100644
--- a/nixos/modules/services/misc/airsonic.nix
+++ b/nixos/modules/services/misc/airsonic.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.airsonic;
+ opt = options.services.airsonic;
in {
options = {
@@ -78,7 +79,7 @@ in {
description = ''
List of paths to transcoder executables that should be accessible
from Airsonic. Symlinks will be created to each executable inside
- ${cfg.home}/transcoders.
+ ''${config.${opt.home}}/transcoders.
'';
};
diff --git a/nixos/modules/services/misc/etcd.nix b/nixos/modules/services/misc/etcd.nix
index 26ad1ad5536a..3925b7dd1636 100644
--- a/nixos/modules/services/misc/etcd.nix
+++ b/nixos/modules/services/misc/etcd.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.etcd;
+ opt = options.services.etcd;
in {
@@ -24,6 +25,7 @@ in {
advertiseClientUrls = mkOption {
description = "Etcd list of this member's client URLs to advertise to the rest of the cluster.";
default = cfg.listenClientUrls;
+ defaultText = literalExpression "config.${opt.listenClientUrls}";
type = types.listOf types.str;
};
@@ -42,12 +44,14 @@ in {
initialAdvertisePeerUrls = mkOption {
description = "Etcd list of this member's peer URLs to advertise to rest of the cluster.";
default = cfg.listenPeerUrls;
+ defaultText = literalExpression "config.${opt.listenPeerUrls}";
type = types.listOf types.str;
};
initialCluster = mkOption {
description = "Etcd initial cluster configuration for bootstrapping.";
default = ["${cfg.name}=http://127.0.0.1:2380"];
+ defaultText = literalExpression ''["''${config.${opt.name}}=http://127.0.0.1:2380"]'';
type = types.listOf types.str;
};
@@ -96,18 +100,21 @@ in {
peerCertFile = mkOption {
description = "Cert file to use for peer to peer communication";
default = cfg.certFile;
+ defaultText = literalExpression "config.${opt.certFile}";
type = types.nullOr types.path;
};
peerKeyFile = mkOption {
description = "Key file to use for peer to peer communication";
default = cfg.keyFile;
+ defaultText = literalExpression "config.${opt.keyFile}";
type = types.nullOr types.path;
};
peerTrustedCaFile = mkOption {
description = "Certificate authority file to use for peer to peer communication";
default = cfg.trustedCaFile;
+ defaultText = literalExpression "config.${opt.trustedCaFile}";
type = types.nullOr types.path;
};
diff --git a/nixos/modules/services/misc/exhibitor.nix b/nixos/modules/services/misc/exhibitor.nix
index 28c98edf47af..4c935efbd844 100644
--- a/nixos/modules/services/misc/exhibitor.nix
+++ b/nixos/modules/services/misc/exhibitor.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.exhibitor;
+ opt = options.services.exhibitor;
exhibitorConfig = ''
zookeeper-install-directory=${cfg.baseDir}/zookeeper
zookeeper-data-directory=${cfg.zkDataDir}
@@ -165,6 +166,7 @@ in
zkDataDir = mkOption {
type = types.str;
default = "${cfg.baseDir}/zkData";
+ defaultText = literalExpression ''"''${config.${opt.baseDir}}/zkData"'';
description = ''
The Zookeeper data directory
'';
@@ -172,6 +174,7 @@ in
zkLogDir = mkOption {
type = types.path;
default = "${cfg.baseDir}/zkLogs";
+ defaultText = literalExpression ''"''${config.${opt.baseDir}}/zkLogs"'';
description = ''
The Zookeeper logs directory
'';
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index 022a73c2b596..0096286701f4 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.gitea;
+ opt = options.services.gitea;
gitea = cfg.package;
pg = config.services.postgresql;
useMysql = cfg.database.type == "mysql";
@@ -51,6 +52,7 @@ in
log = {
rootPath = mkOption {
default = "${cfg.stateDir}/log";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/log"'';
type = types.str;
description = "Root path for log files.";
};
@@ -84,6 +86,11 @@ in
port = mkOption {
type = types.port;
default = (if !usePostgresql then 3306 else pg.port);
+ defaultText = literalExpression ''
+ if config.${opt.database.type} != "postgresql"
+ then 3306
+ else config.${options.services.postgresql.port}
+ '';
description = "Database host port.";
};
@@ -130,6 +137,7 @@ in
path = mkOption {
type = types.str;
default = "${cfg.stateDir}/data/gitea.db";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/data/gitea.db"'';
description = "Path to the sqlite3 database file.";
};
@@ -166,6 +174,7 @@ in
backupDir = mkOption {
type = types.str;
default = "${cfg.stateDir}/dump";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/dump"'';
description = "Path to the dump files.";
};
};
@@ -199,6 +208,7 @@ in
contentDir = mkOption {
type = types.str;
default = "${cfg.stateDir}/data/lfs";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/data/lfs"'';
description = "Where to store LFS files.";
};
};
@@ -212,6 +222,7 @@ in
repositoryRoot = mkOption {
type = types.str;
default = "${cfg.stateDir}/repositories";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/repositories"'';
description = "Path to the git repositories.";
};
diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix
index 01a7ea42d9db..219155777db9 100644
--- a/nixos/modules/services/misc/gitlab.nix
+++ b/nixos/modules/services/misc/gitlab.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, utils, ... }:
+{ config, lib, options, pkgs, utils, ... }:
with lib;
let
cfg = config.services.gitlab;
+ opt = options.services.gitlab;
ruby = cfg.packages.gitlab.ruby;
@@ -309,6 +310,7 @@ in {
backup.path = mkOption {
type = types.str;
default = cfg.statePath + "/backup";
+ defaultText = literalExpression ''config.${opt.statePath} + "/backup"'';
description = "GitLab path for backups.";
};
@@ -554,6 +556,7 @@ in {
defaultForProjects = mkOption {
type = types.bool;
default = cfg.registry.enable;
+ defaultText = literalExpression "config.${opt.registry.enable}";
description = "If GitLab container registry should be enabled by default for projects.";
};
issuer = mkOption {
diff --git a/nixos/modules/services/misc/gitweb.nix b/nixos/modules/services/misc/gitweb.nix
index 13396bf2eb02..a1180716e36b 100644
--- a/nixos/modules/services/misc/gitweb.nix
+++ b/nixos/modules/services/misc/gitweb.nix
@@ -47,6 +47,7 @@ in
$highlight_bin = "${pkgs.highlight}/bin/highlight";
${cfg.extraConfig}
'';
+ defaultText = literalDocBook "generated config file";
type = types.path;
readOnly = true;
internal = true;
diff --git a/nixos/modules/services/misc/gogs.nix b/nixos/modules/services/misc/gogs.nix
index d7233f10c7cb..c7ae4f494071 100644
--- a/nixos/modules/services/misc/gogs.nix
+++ b/nixos/modules/services/misc/gogs.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.gogs;
+ opt = options.services.gogs;
configFile = pkgs.writeText "app.ini" ''
APP_NAME = ${cfg.appName}
RUN_USER = ${cfg.user}
@@ -129,6 +130,7 @@ in
path = mkOption {
type = types.str;
default = "${cfg.stateDir}/data/gogs.db";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/data/gogs.db"'';
description = "Path to the sqlite3 database file.";
};
};
@@ -142,6 +144,7 @@ in
repositoryRoot = mkOption {
type = types.str;
default = "${cfg.stateDir}/repositories";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/repositories"'';
description = "Path to the git repositories.";
};
diff --git a/nixos/modules/services/misc/headphones.nix b/nixos/modules/services/misc/headphones.nix
index 3ee0a4458bd0..31bd61cb4c20 100644
--- a/nixos/modules/services/misc/headphones.nix
+++ b/nixos/modules/services/misc/headphones.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
@@ -7,6 +7,7 @@ let
name = "headphones";
cfg = config.services.headphones;
+ opt = options.services.headphones;
in
@@ -29,6 +30,7 @@ in
configFile = mkOption {
type = types.path;
default = "${cfg.dataDir}/config.ini";
+ defaultText = literalExpression ''"''${config.${opt.dataDir}}/config.ini"'';
description = "Path to config file.";
};
host = mkOption {
diff --git a/nixos/modules/services/misc/matrix-appservice-discord.nix b/nixos/modules/services/misc/matrix-appservice-discord.nix
index 947471e56b46..8a8c7f41e3cb 100644
--- a/nixos/modules/services/misc/matrix-appservice-discord.nix
+++ b/nixos/modules/services/misc/matrix-appservice-discord.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, lib, ... }:
+{ config, options, pkgs, lib, ... }:
with lib;
@@ -7,6 +7,7 @@ let
registrationFile = "${dataDir}/discord-registration.yaml";
appDir = "${pkgs.matrix-appservice-discord}/${pkgs.matrix-appservice-discord.passthru.nodeAppDir}";
cfg = config.services.matrix-appservice-discord;
+ opt = options.services.matrix-appservice-discord;
# TODO: switch to configGen.json once RFC42 is implemented
settingsFile = pkgs.writeText "matrix-appservice-discord-settings.json" (builtins.toJSON cfg.settings);
@@ -74,6 +75,7 @@ in {
url = mkOption {
type = types.str;
default = "http://localhost:${toString cfg.port}";
+ defaultText = literalExpression ''"http://localhost:''${toString config.${opt.port}}"'';
description = ''
The URL where the application service is listening for HS requests.
'';
diff --git a/nixos/modules/services/misc/matrix-synapse.nix b/nixos/modules/services/misc/matrix-synapse.nix
index 0f96f6b1ee22..cce73a47026f 100644
--- a/nixos/modules/services/misc/matrix-synapse.nix
+++ b/nixos/modules/services/misc/matrix-synapse.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.matrix-synapse;
+ opt = options.services.matrix-synapse;
pg = config.services.postgresql;
usePostgresql = cfg.database_type == "psycopg2";
logConfigFile = pkgs.writeText "log_config.yaml" cfg.logConfig;
@@ -197,7 +198,7 @@ in {
tls_certificate_path = mkOption {
type = types.nullOr types.str;
default = null;
- example = "${cfg.dataDir}/homeserver.tls.crt";
+ example = "/var/lib/matrix-synapse/homeserver.tls.crt";
description = ''
PEM encoded X509 certificate for TLS.
You can replace the self-signed certificate that synapse
@@ -209,7 +210,7 @@ in {
tls_private_key_path = mkOption {
type = types.nullOr types.str;
default = null;
- example = "${cfg.dataDir}/homeserver.tls.key";
+ example = "/var/lib/matrix-synapse/homeserver.tls.key";
description = ''
PEM encoded private key for TLS. Specify null if synapse is not
speaking TLS directly.
@@ -218,7 +219,7 @@ in {
tls_dh_params_path = mkOption {
type = types.nullOr types.str;
default = null;
- example = "${cfg.dataDir}/homeserver.tls.dh";
+ example = "/var/lib/matrix-synapse/homeserver.tls.dh";
description = ''
PEM dh parameters for ephemeral keys
'';
@@ -408,6 +409,29 @@ in {
database = cfg.database_name;
};
}.${cfg.database_type};
+ defaultText = literalDocBook ''
+
+
+ using sqlite3
+
+
+ { database = "''${config.${opt.dataDir}}/homeserver.db"; }
+
+
+
+
+ using psycopg2
+
+
+ psycopg2 = {
+ user = config.${opt.database_user};
+ database = config.${opt.database_name};
+ }
+
+
+
+
+ '';
description = ''
Arguments to pass to the engine.
'';
diff --git a/nixos/modules/services/misc/mediatomb.nix b/nixos/modules/services/misc/mediatomb.nix
index 383090575b22..ea9ffbb86775 100644
--- a/nixos/modules/services/misc/mediatomb.nix
+++ b/nixos/modules/services/misc/mediatomb.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
@@ -6,6 +6,7 @@ let
gid = config.ids.gids.mediatomb;
cfg = config.services.mediatomb;
+ opt = options.services.mediatomb;
name = cfg.package.pname;
pkg = cfg.package;
optionYesNo = option: if option then "yes" else "no";
@@ -261,6 +262,7 @@ in {
dataDir = mkOption {
type = types.path;
default = "/var/lib/${name}";
+ defaultText = literalExpression ''"/var/lib/''${config.${opt.package}.pname}"'';
description = ''
The directory where Gerbera/Mediatomb stores its state, data, etc.
'';
@@ -277,13 +279,13 @@ in {
user = mkOption {
type = types.str;
default = "mediatomb";
- description = "User account under which ${name} runs.";
+ description = "User account under which the service runs.";
};
group = mkOption {
type = types.str;
default = "mediatomb";
- description = "Group account under which ${name} runs.";
+ description = "Group account under which the service runs.";
};
port = mkOption {
@@ -340,7 +342,7 @@ in {
type = types.bool;
default = false;
description = ''
- Allow ${name} to create and use its own config file inside the dataDir as
+ Allow the service to create and use its own config file inside the dataDir as
configured by .
Deactivated by default, the service then runs with the configuration generated from this module.
Otherwise, when enabled, no service configuration is generated. Gerbera/Mediatomb then starts using
diff --git a/nixos/modules/services/misc/moonraker.nix b/nixos/modules/services/misc/moonraker.nix
index e08d2f84212d..ae57aaa6d479 100644
--- a/nixos/modules/services/misc/moonraker.nix
+++ b/nixos/modules/services/misc/moonraker.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
pkg = pkgs.moonraker;
cfg = config.services.moonraker;
+ opt = options.services.moonraker;
format = pkgs.formats.ini {
# https://github.com/NixOS/nixpkgs/pull/121613#issuecomment-885241996
listToValue = l:
@@ -31,6 +32,7 @@ in {
configDir = mkOption {
type = types.path;
default = cfg.stateDir + "/config";
+ defaultText = literalExpression ''config.${opt.stateDir} + "/config"'';
description = ''
The directory containing client-writable configuration files.
diff --git a/nixos/modules/services/misc/mwlib.nix b/nixos/modules/services/misc/mwlib.nix
index 8dd17c06c0b3..fedc1e5542a4 100644
--- a/nixos/modules/services/misc/mwlib.nix
+++ b/nixos/modules/services/misc/mwlib.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.mwlib;
+ opt = options.services.mwlib;
pypkgs = pkgs.python27Packages;
inherit (pypkgs) python mwlib;
@@ -46,6 +47,9 @@ in
qserve = mkOption {
default = [ "${cfg.qserve.address}:${toString cfg.qserve.port}" ];
+ defaultText = literalExpression ''
+ [ "''${config.${opt.qserve.address}}:''${toString config.${opt.qserve.port}}"
+ ]'';
type = types.listOf types.str;
description = "Register qserve instance.";
}; # nserve.qserve
@@ -96,6 +100,7 @@ in
nslave = {
enable = mkOption {
default = cfg.qserve.enable;
+ defaultText = literalExpression "config.${opt.qserve.enable}";
type = types.bool;
description = ''
Pulls new jobs from exactly one qserve instance
@@ -127,7 +132,7 @@ in
You have to enable it, or use your own way for serving files
and set the http.url option accordingly.
'';
- type = types.submodule ({
+ type = types.submodule ({ config, options, ... }: {
options = {
enable = mkOption {
default = true;
@@ -148,7 +153,8 @@ in
}; # nslave.http.address
url = mkOption {
- default = "http://localhost:${toString cfg.nslave.http.port}/cache";
+ default = "http://localhost:${toString config.port}/cache";
+ defaultText = literalExpression ''"http://localhost:''${toString config.${options.port}}/cache"'';
type = types.str;
description = ''
Specify URL for accessing generated files from cache.
diff --git a/nixos/modules/services/misc/rippled.nix b/nixos/modules/services/misc/rippled.nix
index 9c66df2fce1c..f6ec0677774b 100644
--- a/nixos/modules/services/misc/rippled.nix
+++ b/nixos/modules/services/misc/rippled.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.rippled;
+ opt = options.services.rippled;
b2i = val: if val then "1" else "0";
@@ -165,6 +166,7 @@ let
description = "Location to store the database.";
type = types.path;
default = cfg.databasePath;
+ defaultText = literalExpression "config.${opt.databasePath}";
};
compression = mkOption {
@@ -177,6 +179,7 @@ let
description = "Enable automatic purging of older ledger information.";
type = types.nullOr (types.addCheck types.int (v: v > 256));
default = cfg.ledgerHistory;
+ defaultText = literalExpression "config.${opt.ledgerHistory}";
};
advisoryDelete = mkOption {
@@ -398,6 +401,7 @@ in
config = mkOption {
internal = true;
default = pkgs.writeText "rippled.conf" rippledCfg;
+ defaultText = literalDocBook "generated config file";
};
};
};
diff --git a/nixos/modules/services/misc/sickbeard.nix b/nixos/modules/services/misc/sickbeard.nix
index 8e871309c98e..a3db99286342 100644
--- a/nixos/modules/services/misc/sickbeard.nix
+++ b/nixos/modules/services/misc/sickbeard.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
@@ -7,6 +7,7 @@ let
name = "sickbeard";
cfg = config.services.sickbeard;
+ opt = options.services.sickbeard;
sickbeard = cfg.package;
in
@@ -39,6 +40,7 @@ in
configFile = mkOption {
type = types.path;
default = "${cfg.dataDir}/config.ini";
+ defaultText = literalExpression ''"''${config.${opt.dataDir}}/config.ini"'';
description = "Path to config file.";
};
port = mkOption {
diff --git a/nixos/modules/services/misc/sourcehut/builds.nix b/nixos/modules/services/misc/sourcehut/builds.nix
index f806e8c51b99..685a132d3507 100644
--- a/nixos/modules/services/misc/sourcehut/builds.nix
+++ b/nixos/modules/services/misc/sourcehut/builds.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
scfg = cfg.builds;
rcfg = config.services.redis;
iniKey = "builds.sr.ht";
@@ -38,6 +39,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/buildsrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/buildsrht"'';
description = ''
State path for builds.sr.ht.
'';
@@ -61,7 +63,7 @@ in
rev = "ff96a0fa5635770390b184ae74debea75c3fd534";
ref = "nixos-unstable";
};
- image_from_nixpkgs = pkgs_unstable: (import ("${pkgs.sourcehut.buildsrht}/lib/images/nixos/image.nix") {
+ image_from_nixpkgs = pkgs_unstable: (import ("''${pkgs.sourcehut.buildsrht}/lib/images/nixos/image.nix") {
pkgs = (import pkgs_unstable {});
});
in
diff --git a/nixos/modules/services/misc/sourcehut/dispatch.nix b/nixos/modules/services/misc/sourcehut/dispatch.nix
index a9db17bebe8e..292a51d3e1c5 100644
--- a/nixos/modules/services/misc/sourcehut/dispatch.nix
+++ b/nixos/modules/services/misc/sourcehut/dispatch.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
cfgIni = cfg.settings;
scfg = cfg.dispatch;
iniKey = "dispatch.sr.ht";
@@ -38,6 +39,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/dispatchsrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/dispatchsrht"'';
description = ''
State path for dispatch.sr.ht.
'';
diff --git a/nixos/modules/services/misc/sourcehut/git.nix b/nixos/modules/services/misc/sourcehut/git.nix
index 2653d77876dc..5ce16df8cd87 100644
--- a/nixos/modules/services/misc/sourcehut/git.nix
+++ b/nixos/modules/services/misc/sourcehut/git.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
scfg = cfg.git;
iniKey = "git.sr.ht";
@@ -41,6 +42,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/gitsrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/gitsrht"'';
description = ''
State path for git.sr.ht.
'';
diff --git a/nixos/modules/services/misc/sourcehut/hg.nix b/nixos/modules/services/misc/sourcehut/hg.nix
index 5cd36bb04550..6ba1df8b6ddb 100644
--- a/nixos/modules/services/misc/sourcehut/hg.nix
+++ b/nixos/modules/services/misc/sourcehut/hg.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
scfg = cfg.hg;
iniKey = "hg.sr.ht";
@@ -40,6 +41,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/hgsrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/hgsrht"'';
description = ''
State path for hg.sr.ht.
'';
diff --git a/nixos/modules/services/misc/sourcehut/hub.nix b/nixos/modules/services/misc/sourcehut/hub.nix
index be3ea21011c7..7d137a765056 100644
--- a/nixos/modules/services/misc/sourcehut/hub.nix
+++ b/nixos/modules/services/misc/sourcehut/hub.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
cfgIni = cfg.settings;
scfg = cfg.hub;
iniKey = "hub.sr.ht";
@@ -38,6 +39,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/hubsrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/hubsrht"'';
description = ''
State path for hub.sr.ht.
'';
diff --git a/nixos/modules/services/misc/sourcehut/lists.nix b/nixos/modules/services/misc/sourcehut/lists.nix
index 7b1fe9fd4630..76f155caa05b 100644
--- a/nixos/modules/services/misc/sourcehut/lists.nix
+++ b/nixos/modules/services/misc/sourcehut/lists.nix
@@ -1,11 +1,12 @@
# Email setup is fairly involved, useful references:
# https://drewdevault.com/2018/08/05/Local-mail-server.html
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
cfgIni = cfg.settings;
scfg = cfg.lists;
iniKey = "lists.sr.ht";
@@ -42,6 +43,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/listssrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/listssrht"'';
description = ''
State path for lists.sr.ht.
'';
diff --git a/nixos/modules/services/misc/sourcehut/man.nix b/nixos/modules/services/misc/sourcehut/man.nix
index 7693396d187c..8ca271c32ee3 100644
--- a/nixos/modules/services/misc/sourcehut/man.nix
+++ b/nixos/modules/services/misc/sourcehut/man.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
cfgIni = cfg.settings;
scfg = cfg.man;
iniKey = "man.sr.ht";
@@ -38,6 +39,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/mansrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/mansrht"'';
description = ''
State path for man.sr.ht.
'';
diff --git a/nixos/modules/services/misc/sourcehut/meta.nix b/nixos/modules/services/misc/sourcehut/meta.nix
index 56127a824eb4..33e4f2332b53 100644
--- a/nixos/modules/services/misc/sourcehut/meta.nix
+++ b/nixos/modules/services/misc/sourcehut/meta.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
cfgIni = cfg.settings;
scfg = cfg.meta;
iniKey = "meta.sr.ht";
@@ -39,6 +40,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/metasrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/metasrht"'';
description = ''
State path for meta.sr.ht.
'';
diff --git a/nixos/modules/services/misc/sourcehut/paste.nix b/nixos/modules/services/misc/sourcehut/paste.nix
index b2d5151969ea..b481ebaf8917 100644
--- a/nixos/modules/services/misc/sourcehut/paste.nix
+++ b/nixos/modules/services/misc/sourcehut/paste.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
cfgIni = cfg.settings;
scfg = cfg.paste;
iniKey = "paste.sr.ht";
@@ -39,6 +40,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/pastesrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/pastesrht"'';
description = ''
State path for pastesrht.sr.ht.
'';
diff --git a/nixos/modules/services/misc/sourcehut/todo.nix b/nixos/modules/services/misc/sourcehut/todo.nix
index aec773b06692..262fa48f59d4 100644
--- a/nixos/modules/services/misc/sourcehut/todo.nix
+++ b/nixos/modules/services/misc/sourcehut/todo.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.sourcehut;
+ opt = options.services.sourcehut;
cfgIni = cfg.settings;
scfg = cfg.todo;
iniKey = "todo.sr.ht";
@@ -39,6 +40,7 @@ in
statePath = mkOption {
type = types.path;
default = "${cfg.statePath}/todosrht";
+ defaultText = literalExpression ''"''${config.${opt.statePath}}/todosrht"'';
description = ''
State path for todo.sr.ht.
'';
diff --git a/nixos/modules/services/misc/subsonic.nix b/nixos/modules/services/misc/subsonic.nix
index 98b85918ad18..2dda8970dd30 100644
--- a/nixos/modules/services/misc/subsonic.nix
+++ b/nixos/modules/services/misc/subsonic.nix
@@ -1,8 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
-let cfg = config.services.subsonic; in {
+let
+ cfg = config.services.subsonic;
+ opt = options.services.subsonic;
+in {
options = {
services.subsonic = {
enable = mkEnableOption "Subsonic daemon";
@@ -97,7 +100,7 @@ let cfg = config.services.subsonic; in {
description = ''
List of paths to transcoder executables that should be accessible
from Subsonic. Symlinks will be created to each executable inside
- ${cfg.home}/transcoders.
+ ''${config.${opt.home}}/transcoders.
'';
};
};
diff --git a/nixos/modules/services/misc/zoneminder.nix b/nixos/modules/services/misc/zoneminder.nix
index 378da7b87442..407742f72ad5 100644
--- a/nixos/modules/services/misc/zoneminder.nix
+++ b/nixos/modules/services/misc/zoneminder.nix
@@ -171,7 +171,7 @@ in {
example = "/storage/tank";
description = ''
ZoneMinder can generate quite a lot of data, so in case you don't want
- to use the default ${home}, you can override the path here.
+ to use the default ${defaultDir}, you can override the path here.
'';
};
diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix
index 5067047e9690..81fca33f5fec 100644
--- a/nixos/modules/services/monitoring/grafana.nix
+++ b/nixos/modules/services/monitoring/grafana.nix
@@ -404,6 +404,7 @@ in {
path = mkOption {
description = "Database path.";
default = "${cfg.dataDir}/data/grafana.db";
+ defaultText = literalExpression ''"''${config.${opt.dataDir}}/data/grafana.db"'';
type = types.path;
};
diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix
index 0dbb33530c92..baa943302a00 100644
--- a/nixos/modules/services/monitoring/graphite.nix
+++ b/nixos/modules/services/monitoring/graphite.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.graphite;
+ opt = options.services.graphite;
writeTextOrNull = f: t: mapNullable (pkgs.writeTextDir f) t;
dataDir = cfg.dataDir;
@@ -171,6 +172,13 @@ in {
directories:
- ${dataDir}/whisper
'';
+ defaultText = literalExpression ''
+ '''
+ whisper:
+ directories:
+ - ''${config.${opt.dataDir}}/whisper
+ '''
+ '';
example = ''
allowed_origins:
- dashboard.example.com
@@ -312,12 +320,14 @@ in {
seyrenUrl = mkOption {
default = "http://localhost:${toString cfg.seyren.port}/";
+ defaultText = literalExpression ''"http://localhost:''${toString config.${opt.seyren.port}}/"'';
description = "Host where seyren is accessible.";
type = types.str;
};
graphiteUrl = mkOption {
default = "http://${cfg.web.listenAddress}:${toString cfg.web.port}";
+ defaultText = literalExpression ''"http://''${config.${opt.web.listenAddress}}:''${toString config.${opt.web.port}}"'';
description = "Host where graphite service runs.";
type = types.str;
};
diff --git a/nixos/modules/services/monitoring/parsedmarc.nix b/nixos/modules/services/monitoring/parsedmarc.nix
index 8571e1f01ed6..ec71365ba3c1 100644
--- a/nixos/modules/services/monitoring/parsedmarc.nix
+++ b/nixos/modules/services/monitoring/parsedmarc.nix
@@ -1,7 +1,8 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
let
cfg = config.services.parsedmarc;
+ opt = options.services.parsedmarc;
ini = pkgs.formats.ini {};
in
{
@@ -80,6 +81,9 @@ in
datasource = lib.mkOption {
type = lib.types.bool;
default = cfg.provision.elasticsearch && config.services.grafana.enable;
+ defaultText = lib.literalExpression ''
+ config.${opt.provision.elasticsearch} && config.${options.services.grafana.enable}
+ '';
apply = x: x && cfg.provision.elasticsearch;
description = ''
Whether the automatically provisioned Elasticsearch
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix
index 73021b1b4d38..6d39cc3e4e6b 100644
--- a/nixos/modules/services/monitoring/smartd.nix
+++ b/nixos/modules/services/monitoring/smartd.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
@@ -8,6 +8,7 @@ let
+ optionalString (config.networking.domain != null) ".${config.networking.domain}";
cfg = config.services.smartd;
+ opt = options.services.smartd;
nm = cfg.notifications.mail;
nw = cfg.notifications.wall;
@@ -211,6 +212,7 @@ in
autodetected = mkOption {
default = cfg.defaults.monitored;
+ defaultText = literalExpression "config.${opt.defaults.monitored}";
type = types.separatedString " ";
description = ''
Like , but for the
diff --git a/nixos/modules/services/monitoring/thanos.nix b/nixos/modules/services/monitoring/thanos.nix
index da626788d827..9e93d8dbb0ef 100644
--- a/nixos/modules/services/monitoring/thanos.nix
+++ b/nixos/modules/services/monitoring/thanos.nix
@@ -83,6 +83,9 @@ let
mkArgumentsOption = cmd: mkOption {
type = types.listOf types.str;
default = argumentsOf cmd;
+ defaultText = literalDocBook ''
+ calculated from config.services.thanos.${cmd}
+ '';
description = ''
Arguments to the thanos ${cmd} command.
diff --git a/nixos/modules/services/monitoring/uptime.nix b/nixos/modules/services/monitoring/uptime.nix
index 245badc3e44f..79b86be6cc71 100644
--- a/nixos/modules/services/monitoring/uptime.nix
+++ b/nixos/modules/services/monitoring/uptime.nix
@@ -1,8 +1,9 @@
-{ config, pkgs, lib, ... }:
+{ config, options, pkgs, lib, ... }:
let
- inherit (lib) mkOption mkEnableOption mkIf mkMerge types optional;
+ inherit (lib) literalExpression mkOption mkEnableOption mkIf mkMerge types optional;
cfg = config.services.uptime;
+ opt = options.services.uptime;
configDir = pkgs.runCommand "config" { preferLocalBuild = true; }
(if cfg.configFile != null then ''
@@ -52,7 +53,10 @@ in {
enableWebService = mkEnableOption "the uptime monitoring program web service";
- enableSeparateMonitoringService = mkEnableOption "the uptime monitoring service" // { default = cfg.enableWebService; };
+ enableSeparateMonitoringService = mkEnableOption "the uptime monitoring service" // {
+ default = cfg.enableWebService;
+ defaultText = literalExpression "config.${opt.enableWebService}";
+ };
nodeEnv = mkOption {
description = "The node environment to run in (development, production, etc.)";
diff --git a/nixos/modules/services/monitoring/zabbix-proxy.nix b/nixos/modules/services/monitoring/zabbix-proxy.nix
index b5009f47f175..0ebd7bcff834 100644
--- a/nixos/modules/services/monitoring/zabbix-proxy.nix
+++ b/nixos/modules/services/monitoring/zabbix-proxy.nix
@@ -1,7 +1,8 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
let
cfg = config.services.zabbixProxy;
+ opt = options.services.zabbixProxy;
pgsql = config.services.postgresql;
mysql = config.services.mysql;
@@ -103,6 +104,11 @@ in
port = mkOption {
type = types.int;
default = if cfg.database.type == "mysql" then mysql.port else pgsql.port;
+ defaultText = literalExpression ''
+ if config.${opt.database.type} == "mysql"
+ then config.${options.services.mysql.port}
+ else config.${options.services.postgresql.port}
+ '';
description = "Database host port.";
};
diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix
index 0141c073da25..9f960517a81b 100644
--- a/nixos/modules/services/monitoring/zabbix-server.nix
+++ b/nixos/modules/services/monitoring/zabbix-server.nix
@@ -1,7 +1,8 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
let
cfg = config.services.zabbixServer;
+ opt = options.services.zabbixServer;
pgsql = config.services.postgresql;
mysql = config.services.mysql;
@@ -95,6 +96,11 @@ in
port = mkOption {
type = types.int;
default = if cfg.database.type == "mysql" then mysql.port else pgsql.port;
+ defaultText = literalExpression ''
+ if config.${opt.database.type} == "mysql"
+ then config.${options.services.mysql.port}
+ else config.${options.services.postgresql.port}
+ '';
description = "Database host port.";
};
diff --git a/nixos/modules/services/networking/amuled.nix b/nixos/modules/services/networking/amuled.nix
index 39320643dd5e..e55ac7a6b18b 100644
--- a/nixos/modules/services/networking/amuled.nix
+++ b/nixos/modules/services/networking/amuled.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.amule;
+ opt = options.services.amule;
user = if cfg.user != null then cfg.user else "amule";
in
@@ -26,6 +27,9 @@ in
dataDir = mkOption {
type = types.str;
default = "/home/${user}/";
+ defaultText = literalExpression ''
+ "/home/''${config.${opt.user}}/"
+ '';
description = ''
The directory holding configuration, incoming and temporary files.
'';
diff --git a/nixos/modules/services/networking/ergo.nix b/nixos/modules/services/networking/ergo.nix
index c52de30dc361..6e55a7cfff6c 100644
--- a/nixos/modules/services/networking/ergo.nix
+++ b/nixos/modules/services/networking/ergo.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
let
cfg = config.services.ergo;
+ opt = options.services.ergo;
- inherit (lib) mkEnableOption mkIf mkOption optionalString types;
+ inherit (lib) literalExpression mkEnableOption mkIf mkOption optionalString types;
configFile = pkgs.writeText "ergo.conf" (''
ergo {
@@ -92,6 +93,7 @@ in {
group = mkOption {
type = types.str;
default = cfg.user;
+ defaultText = literalExpression "config.${opt.user}";
description = "The group as which to run the Ergo node.";
};
diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix
index b5b46fe6042c..ff023a888f26 100644
--- a/nixos/modules/services/networking/firewall.nix
+++ b/nixos/modules/services/networking/firewall.nix
@@ -421,6 +421,7 @@ in
checkReversePath = mkOption {
type = types.either types.bool (types.enum ["strict" "loose"]);
default = kernelHasRPFilter;
+ defaultText = literalDocBook "true if supported by the chosen kernel";
example = "loose";
description =
''
diff --git a/nixos/modules/services/networking/jibri/default.nix b/nixos/modules/services/networking/jibri/default.nix
index 96832b0eb552..113a7aa4384a 100644
--- a/nixos/modules/services/networking/jibri/default.nix
+++ b/nixos/modules/services/networking/jibri/default.nix
@@ -132,7 +132,7 @@ in
pkgs.writeScript "finalize_recording.sh" ''''''
#!/bin/sh
RECORDINGS_DIR=$1
- ${pkgs.rclone}/bin/rclone copy $RECORDINGS_DIR RCLONE_REMOTE:jibri-recordings/ -v --log-file=/var/log/jitsi/jibri/recording-upload.txt
+ ''${pkgs.rclone}/bin/rclone copy $RECORDINGS_DIR RCLONE_REMOTE:jibri-recordings/ -v --log-file=/var/log/jitsi/jibri/recording-upload.txt
exit 0
'''''';
'';
diff --git a/nixos/modules/services/networking/ntopng.nix b/nixos/modules/services/networking/ntopng.nix
index c15257117137..77a004e8ab3a 100644
--- a/nixos/modules/services/networking/ntopng.nix
+++ b/nixos/modules/services/networking/ntopng.nix
@@ -1,10 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.ntopng;
+ opt = options.services.ntopng;
redisCfg = config.services.redis;
configFile = if cfg.configText != "" then
@@ -35,8 +36,8 @@ in
collection tool.
With the default configuration, ntopng monitors all network
- interfaces and displays its findings at http://localhost:${toString
- cfg.http-port}. Default username and password is admin/admin.
+ interfaces and displays its findings at http://localhost:''${toString
+ config.${opt.http-port}}. Default username and password is admin/admin.
See the ntopng(8) manual page and http://www.ntop.org/products/ntop/
for more info.
diff --git a/nixos/modules/services/networking/quassel.nix b/nixos/modules/services/networking/quassel.nix
index 22940ef7a13a..844c9a6b8b35 100644
--- a/nixos/modules/services/networking/quassel.nix
+++ b/nixos/modules/services/networking/quassel.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.quassel;
+ opt = options.services.quassel;
quassel = cfg.package;
user = if cfg.user != null then cfg.user else "quassel";
in
@@ -63,6 +64,9 @@ in
dataDir = mkOption {
default = "/home/${user}/.config/quassel-irc.org";
+ defaultText = literalExpression ''
+ "/home/''${config.${opt.user}}/.config/quassel-irc.org"
+ '';
type = types.str;
description = ''
The directory holding configuration files, the SQlite database and the SSL Cert.
diff --git a/nixos/modules/services/networking/quorum.nix b/nixos/modules/services/networking/quorum.nix
index 50148dc314da..bddcd18c7fbe 100644
--- a/nixos/modules/services/networking/quorum.nix
+++ b/nixos/modules/services/networking/quorum.nix
@@ -1,9 +1,10 @@
-{ config, pkgs, lib, ... }:
+{ config, options, pkgs, lib, ... }:
let
inherit (lib) mkEnableOption mkIf mkOption literalExpression types optionalString;
cfg = config.services.quorum;
+ opt = options.services.quorum;
dataDir = "/var/lib/quorum";
genesisFile = pkgs.writeText "genesis.json" (builtins.toJSON cfg.genesis);
staticNodesFile = pkgs.writeText "static-nodes.json" (builtins.toJSON cfg.staticNodes);
@@ -23,6 +24,7 @@ in {
group = mkOption {
type = types.str;
default = cfg.user;
+ defaultText = literalExpression "config.${opt.user}";
description = "The group as which to run quorum.";
};
diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix
index 8c44687a3822..e37e324019e8 100644
--- a/nixos/modules/services/networking/syncthing.nix
+++ b/nixos/modules/services/networking/syncthing.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.syncthing;
+ opt = options.services.syncthing;
defaultUser = "syncthing";
defaultGroup = defaultUser;
@@ -431,7 +432,26 @@ in {
The path where the settings and keys will exist.
'';
default = cfg.dataDir + optionalString cond "/.config/syncthing";
- defaultText = literalExpression "dataDir${optionalString cond " + \"/.config/syncthing\""}";
+ defaultText = literalDocBook ''
+
+
+ stateVersion >= 19.03
+
+
+ config.${opt.dataDir} + "/.config/syncthing"
+
+
+
+
+ otherwise
+
+
+ config.${opt.dataDir}
+
+
+
+
+ '';
};
extraFlags = mkOption {
diff --git a/nixos/modules/services/networking/wasabibackend.nix b/nixos/modules/services/networking/wasabibackend.nix
index 8482823e197f..b6dcd940915a 100644
--- a/nixos/modules/services/networking/wasabibackend.nix
+++ b/nixos/modules/services/networking/wasabibackend.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
let
cfg = config.services.wasabibackend;
+ opt = options.services.wasabibackend;
- inherit (lib) mkEnableOption mkIf mkOption optionalAttrs optionalString types;
+ inherit (lib) literalExpression mkEnableOption mkIf mkOption optionalAttrs optionalString types;
confOptions = {
BitcoinRpcConnectionString = "${cfg.rpc.user}:${cfg.rpc.password}";
@@ -103,6 +104,7 @@ in {
group = mkOption {
type = types.str;
default = cfg.user;
+ defaultText = literalExpression "config.${opt.user}";
description = "The group as which to run the wasabibackend node.";
};
};
diff --git a/nixos/modules/services/networking/wireguard.nix b/nixos/modules/services/networking/wireguard.nix
index 55b84935b6cb..7cd44b2f8a0a 100644
--- a/nixos/modules/services/networking/wireguard.nix
+++ b/nixos/modules/services/networking/wireguard.nix
@@ -1,10 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.networking.wireguard;
+ opt = options.networking.wireguard;
kernel = config.boot.kernelPackages;
@@ -438,6 +439,7 @@ in
type = types.bool;
# 2019-05-25: Backwards compatibility.
default = cfg.interfaces != {};
+ defaultText = literalExpression "config.${opt.interfaces} != { }";
example = true;
};
diff --git a/nixos/modules/services/networking/wpa_supplicant.nix b/nixos/modules/services/networking/wpa_supplicant.nix
index 4aa350d21a2b..07dec8ea7181 100644
--- a/nixos/modules/services/networking/wpa_supplicant.nix
+++ b/nixos/modules/services/networking/wpa_supplicant.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, utils, ... }:
+{ config, lib, options, pkgs, utils, ... }:
with lib;
@@ -8,6 +8,7 @@ let
else pkgs.wpa_supplicant;
cfg = config.networking.wireless;
+ opt = options.networking.wireless;
# Content of wpa_supplicant.conf
generatedConfig = concatStringsSep "\n" (
@@ -421,6 +422,7 @@ in {
dbusControlled = mkOption {
type = types.bool;
default = lib.length cfg.interfaces < 2;
+ defaultText = literalExpression "length config.${opt.interfaces} < 2";
description = ''
Whether to enable the DBus control interface.
This is only needed when using NetworkManager or connman.
diff --git a/nixos/modules/services/search/kibana.nix b/nixos/modules/services/search/kibana.nix
index 381f5156ceb6..e4ab85be9ef1 100644
--- a/nixos/modules/services/search/kibana.nix
+++ b/nixos/modules/services/search/kibana.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.kibana;
+ opt = options.services.kibana;
ge7 = builtins.compareVersions cfg.package.version "7" >= 0;
lt6_6 = builtins.compareVersions cfg.package.version "6.6" < 0;
@@ -130,6 +131,9 @@ in {
This defaults to the singleton list [ca] when the option is defined.
'';
default = if cfg.elasticsearch.ca == null then [] else [ca];
+ defaultText = literalExpression ''
+ if config.${opt.elasticsearch.ca} == null then [ ] else [ ca ]
+ '';
type = types.listOf types.path;
};
diff --git a/nixos/modules/services/security/privacyidea.nix b/nixos/modules/services/security/privacyidea.nix
index 05f4995cc416..dacbffec04e0 100644
--- a/nixos/modules/services/security/privacyidea.nix
+++ b/nixos/modules/services/security/privacyidea.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.privacyidea;
+ opt = options.services.privacyidea;
uwsgi = pkgs.uwsgi.override { plugins = [ "python3" ]; };
python = uwsgi.python3;
@@ -112,6 +113,7 @@ in
encFile = mkOption {
type = types.str;
default = "${cfg.stateDir}/enckey";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/enckey"'';
description = ''
This is used to encrypt the token data and token passwords
'';
@@ -120,6 +122,7 @@ in
auditKeyPrivate = mkOption {
type = types.str;
default = "${cfg.stateDir}/private.pem";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/private.pem"'';
description = ''
Private Key for signing the audit log.
'';
@@ -128,6 +131,7 @@ in
auditKeyPublic = mkOption {
type = types.str;
default = "${cfg.stateDir}/public.pem";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/public.pem"'';
description = ''
Public key for checking signatures of the audit log.
'';
diff --git a/nixos/modules/services/security/tor.nix b/nixos/modules/services/security/tor.nix
index c3e3248ee8ab..f3ed1d160eed 100644
--- a/nixos/modules/services/security/tor.nix
+++ b/nixos/modules/services/security/tor.nix
@@ -1,10 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with builtins;
with lib;
let
cfg = config.services.tor;
+ opt = options.services.tor;
stateDir = "/var/lib/tor";
runDir = "/run/tor";
descriptionGeneric = option: ''
@@ -799,6 +800,11 @@ in
options.SOCKSPort = mkOption {
description = descriptionGeneric "SOCKSPort";
default = if cfg.settings.HiddenServiceNonAnonymousMode == true then [{port = 0;}] else [];
+ defaultText = literalExpression ''
+ if config.${opt.settings}.HiddenServiceNonAnonymousMode == true
+ then [ { port = 0; } ]
+ else [ ]
+ '';
example = [{port = 9090;}];
type = types.listOf (optionSOCKSPort true);
};
diff --git a/nixos/modules/services/security/vault.nix b/nixos/modules/services/security/vault.nix
index b0ade62d97c9..d48bc472cb82 100644
--- a/nixos/modules/services/security/vault.nix
+++ b/nixos/modules/services/security/vault.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.vault;
+ opt = options.services.vault;
configFile = pkgs.writeText "vault.hcl" ''
listener "tcp" {
@@ -83,6 +84,11 @@ in
storagePath = mkOption {
type = types.nullOr types.path;
default = if cfg.storageBackend == "file" then "/var/lib/vault" else null;
+ defaultText = literalExpression ''
+ if config.${opt.storageBackend} == "file"
+ then "/var/lib/vault"
+ else null
+ '';
description = "Data directory for file backend";
};
diff --git a/nixos/modules/services/torrent/peerflix.nix b/nixos/modules/services/torrent/peerflix.nix
index 3e5f80960dc7..821c829f6b4a 100644
--- a/nixos/modules/services/torrent/peerflix.nix
+++ b/nixos/modules/services/torrent/peerflix.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.peerflix;
+ opt = options.services.peerflix;
configFile = pkgs.writeText "peerflix-config.json" ''
{
@@ -32,6 +33,7 @@ in {
downloadDir = mkOption {
description = "Peerflix temporary download directory.";
default = "${cfg.stateDir}/torrents";
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/torrents"'';
type = types.path;
};
};
diff --git a/nixos/modules/services/torrent/rtorrent.nix b/nixos/modules/services/torrent/rtorrent.nix
index dd7df623c739..759dcfe2e6c5 100644
--- a/nixos/modules/services/torrent/rtorrent.nix
+++ b/nixos/modules/services/torrent/rtorrent.nix
@@ -1,10 +1,11 @@
-{ config, pkgs, lib, ... }:
+{ config, options, pkgs, lib, ... }:
with lib;
let
cfg = config.services.rtorrent;
+ opt = options.services.rtorrent;
in {
options.services.rtorrent = {
@@ -21,6 +22,7 @@ in {
downloadDir = mkOption {
type = types.str;
default = "${cfg.dataDir}/download";
+ defaultText = literalExpression ''"''${config.${opt.dataDir}}/download"'';
description = ''
Where to put downloaded files.
'';
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix
index 9e440e49b504..d12d8aa23980 100644
--- a/nixos/modules/services/torrent/transmission.nix
+++ b/nixos/modules/services/torrent/transmission.nix
@@ -4,6 +4,7 @@ with lib;
let
cfg = config.services.transmission;
+ opt = options.services.transmission;
inherit (config.environment) etc;
apparmor = config.security.apparmor;
rootDir = "/run/transmission";
@@ -47,11 +48,13 @@ in
options.download-dir = mkOption {
type = types.path;
default = "${cfg.home}/${downloadsDir}";
+ defaultText = literalExpression ''"''${config.${opt.home}}/${downloadsDir}"'';
description = "Directory where to download torrents.";
};
options.incomplete-dir = mkOption {
type = types.path;
default = "${cfg.home}/${incompleteDir}";
+ defaultText = literalExpression ''"''${config.${opt.home}}/${incompleteDir}"'';
description = ''
When enabled with
services.transmission.home
@@ -147,6 +150,7 @@ in
options.watch-dir = mkOption {
type = types.path;
default = "${cfg.home}/${watchDir}";
+ defaultText = literalExpression ''"''${config.${opt.home}}/${watchDir}"'';
description = "Watch a directory for torrent files and add them to transmission.";
};
options.watch-dir-enabled = mkOption {
diff --git a/nixos/modules/services/video/epgstation/default.nix b/nixos/modules/services/video/epgstation/default.nix
index 56bd9d9eeeca..41613dcbb3ba 100644
--- a/nixos/modules/services/video/epgstation/default.nix
+++ b/nixos/modules/services/video/epgstation/default.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.epgstation;
+ opt = options.services.epgstation;
username = config.users.users.epgstation.name;
groupname = config.users.users.epgstation.group;
@@ -72,6 +73,7 @@ in
socketioPort = mkOption {
type = types.port;
default = cfg.port + 1;
+ defaultText = literalExpression "config.${opt.port} + 1";
description = ''
Socket.io port for EPGStation to listen on.
'';
@@ -80,6 +82,7 @@ in
clientSocketioPort = mkOption {
type = types.port;
default = cfg.socketioPort;
+ defaultText = literalExpression "config.${opt.socketioPort}";
description = ''
Socket.io port that the web client is going to connect to. This may be
different from if EPGStation is hidden
@@ -183,6 +186,9 @@ in
in {
type = types.str;
default = "http+unix://${replaceStrings ["/"] ["%2F"] sockPath}";
+ defaultText = literalExpression ''
+ "http+unix://''${replaceStrings ["/"] ["%2F"] config.${options.services.mirakurun.unixSocket}}"
+ '';
example = "http://localhost:40772";
description = "URL to connect to Mirakurun.";
});
diff --git a/nixos/modules/services/video/unifi-video.nix b/nixos/modules/services/video/unifi-video.nix
index 17971b23db82..43208a9fe4cf 100644
--- a/nixos/modules/services/video/unifi-video.nix
+++ b/nixos/modules/services/video/unifi-video.nix
@@ -1,7 +1,8 @@
-{ config, lib, pkgs, utils, ... }:
+{ config, lib, options, pkgs, utils, ... }:
with lib;
let
cfg = config.services.unifi-video;
+ opt = options.services.unifi-video;
mainClass = "com.ubnt.airvision.Main";
cmd = ''
${pkgs.jsvc}/bin/jsvc \
@@ -164,6 +165,7 @@ in
pidFile = mkOption {
type = types.path;
default = "${cfg.dataDir}/unifi-video.pid";
+ defaultText = literalExpression ''"''${config.${opt.dataDir}}/unifi-video.pid"'';
description = "Location of unifi-video pid file.";
};
diff --git a/nixos/modules/services/web-apps/discourse.nix b/nixos/modules/services/web-apps/discourse.nix
index 18b61200aa1b..2c2911aada3f 100644
--- a/nixos/modules/services/web-apps/discourse.nix
+++ b/nixos/modules/services/web-apps/discourse.nix
@@ -4,6 +4,7 @@ let
json = pkgs.formats.json {};
cfg = config.services.discourse;
+ opt = options.services.discourse;
# Keep in sync with https://github.com/discourse/discourse_docker/blob/master/image/base/Dockerfile#L5
upstreamPostgresqlVersion = lib.getVersion pkgs.postgresql_13;
@@ -327,6 +328,7 @@ in
useSSL = lib.mkOption {
type = lib.types.bool;
default = cfg.redis.host != "localhost";
+ defaultText = lib.literalExpression ''config.${opt.redis.host} != "localhost"'';
description = ''
Connect to Redis with SSL.
'';
@@ -399,6 +401,7 @@ in
domain = lib.mkOption {
type = lib.types.str;
default = cfg.hostname;
+ defaultText = lib.literalExpression "config.${opt.hostname}";
description = ''
HELO domain to use for outgoing mail.
'';
diff --git a/nixos/modules/services/web-apps/galene.nix b/nixos/modules/services/web-apps/galene.nix
index db9dfeb47499..1d0a620585b0 100644
--- a/nixos/modules/services/web-apps/galene.nix
+++ b/nixos/modules/services/web-apps/galene.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.galene;
+ opt = options.services.galene;
defaultstateDir = "/var/lib/galene";
defaultrecordingsDir = "${cfg.stateDir}/recordings";
defaultgroupsDir = "${cfg.stateDir}/groups";
@@ -88,6 +89,7 @@ in
recordingsDir = mkOption {
type = types.str;
default = defaultrecordingsDir;
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/recordings"'';
example = "/var/lib/galene/recordings";
description = "Recordings directory.";
};
@@ -95,6 +97,7 @@ in
dataDir = mkOption {
type = types.str;
default = defaultdataDir;
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/data"'';
example = "/var/lib/galene/data";
description = "Data directory.";
};
@@ -102,6 +105,7 @@ in
groupsDir = mkOption {
type = types.str;
default = defaultgroupsDir;
+ defaultText = literalExpression ''"''${config.${opt.stateDir}}/groups"'';
example = "/var/lib/galene/groups";
description = "Web server directory.";
};
diff --git a/nixos/modules/services/web-apps/hedgedoc.nix b/nixos/modules/services/web-apps/hedgedoc.nix
index e0c00fe67ea3..9eeabb9d5662 100644
--- a/nixos/modules/services/web-apps/hedgedoc.nix
+++ b/nixos/modules/services/web-apps/hedgedoc.nix
@@ -33,7 +33,7 @@ in
type = types.listOf types.str;
default = [];
description = ''
- Groups to which the user ${name} should be added.
+ Groups to which the service user should be added.
'';
};
diff --git a/nixos/modules/services/web-apps/invidious.nix b/nixos/modules/services/web-apps/invidious.nix
index 50370629e47c..10b30bf1fd1d 100644
--- a/nixos/modules/services/web-apps/invidious.nix
+++ b/nixos/modules/services/web-apps/invidious.nix
@@ -225,6 +225,7 @@ in
port = lib.mkOption {
type = types.port;
default = options.services.postgresql.port.default;
+ defaultText = lib.literalExpression "options.services.postgresql.port.default";
description = ''
The port of the database Invidious should use.
diff --git a/nixos/modules/services/web-apps/keycloak.nix b/nixos/modules/services/web-apps/keycloak.nix
index df8c7114102f..e08f6dcabd2f 100644
--- a/nixos/modules/services/web-apps/keycloak.nix
+++ b/nixos/modules/services/web-apps/keycloak.nix
@@ -1,7 +1,8 @@
-{ config, pkgs, lib, ... }:
+{ config, options, pkgs, lib, ... }:
let
cfg = config.services.keycloak;
+ opt = options.services.keycloak;
in
{
options.services.keycloak = {
@@ -139,6 +140,7 @@ in
lib.mkOption {
type = lib.types.port;
default = dbPorts.${cfg.database.type};
+ defaultText = lib.literalDocBook "default port of selected database";
description = ''
Port of the database to connect to.
'';
@@ -147,6 +149,7 @@ in
useSSL = lib.mkOption {
type = lib.types.bool;
default = cfg.database.host != "localhost";
+ defaultText = lib.literalExpression ''config.${opt.database.host} != "localhost"'';
description = ''
Whether the database connection should be secured by SSL /
TLS.
diff --git a/nixos/modules/services/web-apps/matomo.nix b/nixos/modules/services/web-apps/matomo.nix
index eba55e7e9bef..8a0ca33b51f0 100644
--- a/nixos/modules/services/web-apps/matomo.nix
+++ b/nixos/modules/services/web-apps/matomo.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.matomo;
@@ -12,10 +12,7 @@ let
phpExecutionUnit = "phpfpm-${pool}";
databaseService = "mysql.service";
- fqdn =
- let
- join = hostName: domain: hostName + optionalString (domain != null) ".${domain}";
- in join config.networking.hostName config.networking.domain;
+ fqdn = if config.networking.domain != null then config.networking.fqdn else config.networking.hostName;
in {
imports = [
@@ -81,9 +78,14 @@ in {
hostname = mkOption {
type = types.str;
default = "${user}.${fqdn}";
+ defaultText = literalExpression ''
+ if config.${options.networking.domain} != null
+ then "${user}.''${config.${options.networking.fqdn}}"
+ else "${user}.''${config.${options.networking.hostName}}"
+ '';
example = "matomo.yourdomain.org";
description = ''
- URL of the host, without https prefix. By default, this is ${user}.${fqdn}, but you may want to change it if you
+ URL of the host, without https prefix. You may want to change it if you
run Matomo on a different URL than matomo.yourdomain.
'';
};
diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix
index 8345fc10914e..6692d67081c5 100644
--- a/nixos/modules/services/web-apps/nextcloud.nix
+++ b/nixos/modules/services/web-apps/nextcloud.nix
@@ -499,6 +499,7 @@ in {
occ = mkOption {
type = types.package;
default = occ;
+ defaultText = literalDocBook "generated script";
internal = true;
description = ''
The nextcloud-occ program preconfigured to target this Nextcloud instance.
diff --git a/nixos/modules/services/web-apps/peertube.nix b/nixos/modules/services/web-apps/peertube.nix
index 932ddcfef198..a65428018260 100644
--- a/nixos/modules/services/web-apps/peertube.nix
+++ b/nixos/modules/services/web-apps/peertube.nix
@@ -1,7 +1,8 @@
-{ lib, pkgs, config, ... }:
+{ lib, pkgs, config, options, ... }:
let
cfg = config.services.peertube;
+ opt = options.services.peertube;
settingsFormat = pkgs.formats.json {};
configFile = settingsFormat.generate "production.json" cfg.settings;
@@ -153,6 +154,11 @@ in {
host = lib.mkOption {
type = lib.types.str;
default = if cfg.database.createLocally then "/run/postgresql" else null;
+ defaultText = lib.literalExpression ''
+ if config.${opt.database.createLocally}
+ then "/run/postgresql"
+ else null
+ '';
example = "192.168.15.47";
description = "Database host address or unix socket.";
};
@@ -193,12 +199,22 @@ in {
host = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = if cfg.redis.createLocally && !cfg.redis.enableUnixSocket then "127.0.0.1" else null;
+ defaultText = lib.literalExpression ''
+ if config.${opt.redis.createLocally} && !config.${opt.redis.enableUnixSocket}
+ then "127.0.0.1"
+ else null
+ '';
description = "Redis host.";
};
port = lib.mkOption {
type = lib.types.nullOr lib.types.port;
default = if cfg.redis.createLocally && cfg.redis.enableUnixSocket then null else 6379;
+ defaultText = lib.literalExpression ''
+ if config.${opt.redis.createLocally} && config.${opt.redis.enableUnixSocket}
+ then null
+ else 6379
+ '';
description = "Redis port.";
};
@@ -212,6 +228,7 @@ in {
enableUnixSocket = lib.mkOption {
type = lib.types.bool;
default = cfg.redis.createLocally;
+ defaultText = lib.literalExpression "config.${opt.redis.createLocally}";
description = "Use Unix socket.";
};
};
diff --git a/nixos/modules/services/web-apps/pgpkeyserver-lite.nix b/nixos/modules/services/web-apps/pgpkeyserver-lite.nix
index 5642627d397d..faf0ce13238e 100644
--- a/nixos/modules/services/web-apps/pgpkeyserver-lite.nix
+++ b/nixos/modules/services/web-apps/pgpkeyserver-lite.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
@@ -6,6 +6,7 @@ let
cfg = config.services.pgpkeyserver-lite;
sksCfg = config.services.sks;
+ sksOpt = options.services.sks;
webPkg = cfg.package;
@@ -37,6 +38,7 @@ in
hkpAddress = mkOption {
default = builtins.head sksCfg.hkpAddress;
+ defaultText = literalExpression "head config.${sksOpt.hkpAddress}";
type = types.str;
description = "
Wich ip address the sks-keyserver is listening on.
@@ -45,6 +47,7 @@ in
hkpPort = mkOption {
default = sksCfg.hkpPort;
+ defaultText = literalExpression "config.${sksOpt.hkpPort}";
type = types.int;
description = "
Which port the sks-keyserver is listening on.
diff --git a/nixos/modules/services/web-apps/zabbix.nix b/nixos/modules/services/web-apps/zabbix.nix
index ff50b95254f9..538dac0d5be2 100644
--- a/nixos/modules/services/web-apps/zabbix.nix
+++ b/nixos/modules/services/web-apps/zabbix.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
let
@@ -6,6 +6,7 @@ let
inherit (lib) literalExpression mapAttrs optionalString versionAtLeast;
cfg = config.services.zabbixWeb;
+ opt = options.services.zabbixWeb;
fpm = config.services.phpfpm.pools.zabbix;
user = "zabbix";
@@ -82,6 +83,11 @@ in
if cfg.database.type == "mysql" then config.services.mysql.port
else if cfg.database.type == "pgsql" then config.services.postgresql.port
else 1521;
+ defaultText = literalExpression ''
+ if config.${opt.database.type} == "mysql" then config.${options.services.mysql.port}
+ else if config.${opt.database.type} == "pgsql" then config.${options.services.postgresql.port}
+ else 1521
+ '';
description = "Database host port.";
};
diff --git a/nixos/modules/services/web-servers/lighttpd/collectd.nix b/nixos/modules/services/web-servers/lighttpd/collectd.nix
index 3f262451c2cb..5f091591daf9 100644
--- a/nixos/modules/services/web-servers/lighttpd/collectd.nix
+++ b/nixos/modules/services/web-servers/lighttpd/collectd.nix
@@ -1,9 +1,10 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.lighttpd.collectd;
+ opt = options.services.lighttpd.collectd;
collectionConf = pkgs.writeText "collection.conf" ''
datadir: "${config.services.collectd.dataDir}"
@@ -29,6 +30,9 @@ in
collectionCgi = mkOption {
type = types.path;
default = defaultCollectionCgi;
+ defaultText = literalDocBook ''
+ config.${options.services.collectd.package} configured for lighttpd
+ '';
description = ''
Path to collection.cgi script from (collectd sources)/contrib/collection.cgi
This option allows to use a customized version
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix
index bdc46faa7fd0..92b3af8527f1 100644
--- a/nixos/modules/services/x11/display-managers/default.nix
+++ b/nixos/modules/services/x11/display-managers/default.nix
@@ -7,13 +7,14 @@
# (e.g., KDE, Gnome or a plain xterm), and optionally the *window
# manager* (e.g. kwin or twm).
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.xserver;
+ opt = options.services.xserver;
xorg = pkgs.xorg;
fontconfig = config.fonts.fontconfig;
@@ -147,6 +148,7 @@ in
xauthBin = mkOption {
internal = true;
default = "${xorg.xauth}/bin/xauth";
+ defaultText = literalExpression ''"''${pkgs.xorg.xauth}/bin/xauth"'';
description = "Path to the xauth program used by display managers.";
};
@@ -278,6 +280,9 @@ in
defaultSessionFromLegacyOptions
else
null;
+ defaultText = literalDocBook ''
+ Taken from display manager settings or window manager settings, if either is set.
+ '';
example = "gnome";
description = ''
Graphical session to pre-select in the session chooser (only effective for GDM, LightDM and SDDM).
@@ -337,11 +342,12 @@ in
# Configuration for automatic login. Common for all DM.
autoLogin = mkOption {
- type = types.submodule {
+ type = types.submodule ({ config, options, ... }: {
options = {
enable = mkOption {
type = types.bool;
- default = cfg.displayManager.autoLogin.user != null;
+ default = config.user != null;
+ defaultText = literalExpression "config.${options.user} != null";
description = ''
Automatically log in as .
'';
@@ -355,7 +361,7 @@ in
'';
};
};
- };
+ });
default = {};
description = ''
diff --git a/nixos/modules/services/x11/hardware/synaptics.nix b/nixos/modules/services/x11/hardware/synaptics.nix
index 22af869f1f8a..93dd560bca40 100644
--- a/nixos/modules/services/x11/hardware/synaptics.nix
+++ b/nixos/modules/services/x11/hardware/synaptics.nix
@@ -1,8 +1,9 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let cfg = config.services.xserver.synaptics;
+ opt = options.services.xserver.synaptics;
tapConfig = if cfg.tapButtons then enabledTapConfig else disabledTapConfig;
enabledTapConfig = ''
Option "MaxTapTime" "180"
@@ -77,24 +78,28 @@ in {
horizTwoFingerScroll = mkOption {
type = types.bool;
default = cfg.twoFingerScroll;
+ defaultText = literalExpression "config.${opt.twoFingerScroll}";
description = "Whether to enable horizontal two-finger drag-scrolling.";
};
vertTwoFingerScroll = mkOption {
type = types.bool;
default = cfg.twoFingerScroll;
+ defaultText = literalExpression "config.${opt.twoFingerScroll}";
description = "Whether to enable vertical two-finger drag-scrolling.";
};
horizEdgeScroll = mkOption {
type = types.bool;
default = ! cfg.horizTwoFingerScroll;
+ defaultText = literalExpression "! config.${opt.horizTwoFingerScroll}";
description = "Whether to enable horizontal edge drag-scrolling.";
};
vertEdgeScroll = mkOption {
type = types.bool;
default = ! cfg.vertTwoFingerScroll;
+ defaultText = literalExpression "! config.${opt.vertTwoFingerScroll}";
description = "Whether to enable vertical edge drag-scrolling.";
};
diff --git a/nixos/modules/services/x11/picom.nix b/nixos/modules/services/x11/picom.nix
index dbd4b1cefef1..b40e20bcd357 100644
--- a/nixos/modules/services/x11/picom.nix
+++ b/nixos/modules/services/x11/picom.nix
@@ -1,10 +1,11 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
let
cfg = config.services.picom;
+ opt = options.services.picom;
pairOf = x: with types;
addCheck (listOf x) (y: length y == 2)
@@ -178,7 +179,16 @@ in {
wintypes = mkOption {
type = types.attrs;
- default = { popup_menu = { opacity = cfg.menuOpacity; }; dropdown_menu = { opacity = cfg.menuOpacity; }; };
+ default = {
+ popup_menu = { opacity = cfg.menuOpacity; };
+ dropdown_menu = { opacity = cfg.menuOpacity; };
+ };
+ defaultText = literalExpression ''
+ {
+ popup_menu = { opacity = config.${opt.menuOpacity}; };
+ dropdown_menu = { opacity = config.${opt.menuOpacity}; };
+ }
+ '';
example = {};
description = ''
Rules for specific window types.
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index 4a32387db8da..d6f14d01dbaa 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -142,6 +142,7 @@ in
readOnly = true;
internal = true;
default = systemActivationScript (removeAttrs config.system.activationScripts [ "script" ]) true;
+ defaultText = literalDocBook "generated activation script";
};
system.userActivationScripts = mkOption {
diff --git a/nixos/modules/system/boot/plymouth.nix b/nixos/modules/system/boot/plymouth.nix
index 4b8194d2f85c..78ae8e9d20b7 100644
--- a/nixos/modules/system/boot/plymouth.nix
+++ b/nixos/modules/system/boot/plymouth.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, options, pkgs, ... }:
with lib;
@@ -7,6 +7,7 @@ let
inherit (pkgs) plymouth nixos-icons;
cfg = config.boot.plymouth;
+ opt = options.boot.plymouth;
nixosBreezePlymouth = pkgs.plasma5Packages.breeze-plymouth.override {
logoFile = cfg.logo;
@@ -71,6 +72,11 @@ in
themePackages = mkOption {
default = lib.optional (cfg.theme == "breeze") nixosBreezePlymouth;
+ defaultText = literalDocBook ''
+ A NixOS branded variant of the breeze theme when
+ config.${opt.theme} == "breeze", otherwise
+ [ ].
+ '';
type = types.listOf types.package;
description = ''
Extra theme packages for plymouth.
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix
index 65364801c32a..3bc0dedec00e 100644
--- a/nixos/modules/tasks/filesystems/zfs.nix
+++ b/nixos/modules/tasks/filesystems/zfs.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, utils, ... }:
+{ config, lib, options, pkgs, utils, ... }:
#
# TODO: zfs tunables
@@ -8,6 +8,7 @@ with lib;
let
cfgZfs = config.boot.zfs;
+ optZfs = options.boot.zfs;
cfgExpandOnBoot = config.services.zfs.expandOnBoot;
cfgSnapshots = config.services.zfs.autoSnapshot;
cfgSnapFlags = cfgSnapshots.flags;
@@ -112,6 +113,7 @@ in
readOnly = true;
type = types.bool;
default = inInitrd || inSystem;
+ defaultText = literalDocBook "true if ZFS filesystem support is enabled";
description = "True if ZFS filesystem support is enabled";
};
@@ -346,6 +348,7 @@ in
services.zfs.zed = {
enableMail = mkEnableOption "ZED's ability to send emails" // {
default = cfgZfs.package.enableMail;
+ defaultText = literalExpression "config.${optZfs.package}.enableMail";
};
settings = mkOption {
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 49901cda848d..3d1fa793eb37 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -6,6 +6,7 @@ with utils;
let
cfg = config.networking;
+ opt = options.networking;
interfaces = attrValues cfg.interfaces;
hasVirtuals = any (i: i.virtual) interfaces;
hasSits = cfg.sits != { };
@@ -1169,6 +1170,9 @@ in
networking.tempAddresses = mkOption {
default = if cfg.enableIPv6 then "default" else "disabled";
+ defaultText = literalExpression ''
+ if ''${config.${opt.enableIPv6}} then "default" else "disabled"
+ '';
type = types.enum (lib.attrNames tempaddrValues);
description = ''
Whether to enable IPv6 Privacy Extensions for interfaces not
diff --git a/nixos/modules/virtualisation/cri-o.nix b/nixos/modules/virtualisation/cri-o.nix
index 38766113f391..cf5110001503 100644
--- a/nixos/modules/virtualisation/cri-o.nix
+++ b/nixos/modules/virtualisation/cri-o.nix
@@ -71,6 +71,10 @@ in
package = mkOption {
type = types.package;
default = crioPackage;
+ defaultText = literalDocBook ''
+ pkgs.cri-o built with
+ config.${opt.extraPackages}.
+ '';
internal = true;
description = ''
The final CRI-O package (including extra packages).