0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

treewide: make option descriptions constants

escape interpolations in descriptions where possible, replace them with
sufficiently descriptive text elsewhere. also expand cfg.* paths in
descriptions.
This commit is contained in:
pennae 2021-12-05 21:58:27 +01:00
parent ed673a69db
commit e72435e612
8 changed files with 22 additions and 16 deletions

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.terraria; cfg = config.services.terraria;
opt = options.services.terraria;
worldSizeMap = { small = 1; medium = 2; large = 3; }; worldSizeMap = { small = 1; medium = 2; large = 3; };
valFlag = name: val: optionalString (val != null) "-${name} \"${escape ["\\" "\""] (toString val)}\""; valFlag = name: val: optionalString (val != null) "-${name} \"${escape ["\\" "\""] (toString val)}\"";
boolFlag = name: val: optionalString val "-${name}"; boolFlag = name: val: optionalString val "-${name}";
@ -36,7 +37,7 @@ in
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
If enabled, starts a Terraria server. The server can be connected to via <literal>tmux -S ${cfg.dataDir}/terraria.sock attach</literal> If enabled, starts a Terraria server. The server can be connected to via <literal>tmux -S ''${config.${opt.dataDir}}/terraria.sock attach</literal>
for administration by users who are a part of the <literal>terraria</literal> group (use <literal>C-b d</literal> shortcut to detach again). for administration by users who are a part of the <literal>terraria</literal> group (use <literal>C-b d</literal> shortcut to detach again).
''; '';
}; };

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.airsonic; cfg = config.services.airsonic;
opt = options.services.airsonic;
in { in {
options = { options = {
@ -78,7 +79,7 @@ in {
description = '' description = ''
List of paths to transcoder executables that should be accessible List of paths to transcoder executables that should be accessible
from Airsonic. Symlinks will be created to each executable inside from Airsonic. Symlinks will be created to each executable inside
${cfg.home}/transcoders. ''${config.${opt.home}}/transcoders.
''; '';
}; };

View file

@ -277,13 +277,13 @@ in {
user = mkOption { user = mkOption {
type = types.str; type = types.str;
default = "mediatomb"; default = "mediatomb";
description = "User account under which ${name} runs."; description = "User account under which the service runs.";
}; };
group = mkOption { group = mkOption {
type = types.str; type = types.str;
default = "mediatomb"; default = "mediatomb";
description = "Group account under which ${name} runs."; description = "Group account under which the service runs.";
}; };
port = mkOption { port = mkOption {
@ -340,7 +340,7 @@ in {
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
Allow ${name} to create and use its own config file inside the <literal>dataDir</literal> as Allow the service to create and use its own config file inside the <literal>dataDir</literal> as
configured by <option>services.mediatomb.dataDir</option>. configured by <option>services.mediatomb.dataDir</option>.
Deactivated by default, the service then runs with the configuration generated from this module. 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 Otherwise, when enabled, no service configuration is generated. Gerbera/Mediatomb then starts using

View file

@ -1,8 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let cfg = config.services.subsonic; in { let
cfg = config.services.subsonic;
opt = options.services.subsonic;
in {
options = { options = {
services.subsonic = { services.subsonic = {
enable = mkEnableOption "Subsonic daemon"; enable = mkEnableOption "Subsonic daemon";
@ -97,7 +100,7 @@ let cfg = config.services.subsonic; in {
description = '' description = ''
List of paths to transcoder executables that should be accessible List of paths to transcoder executables that should be accessible
from Subsonic. Symlinks will be created to each executable inside from Subsonic. Symlinks will be created to each executable inside
${cfg.home}/transcoders. ''${config.${opt.home}}/transcoders.
''; '';
}; };
}; };

View file

@ -171,7 +171,7 @@ in {
example = "/storage/tank"; example = "/storage/tank";
description = '' description = ''
ZoneMinder can generate quite a lot of data, so in case you don't want 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.
''; '';
}; };

View file

@ -1,10 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.ntopng; cfg = config.services.ntopng;
opt = options.services.ntopng;
redisCfg = config.services.redis; redisCfg = config.services.redis;
configFile = if cfg.configText != "" then configFile = if cfg.configText != "" then
@ -35,8 +36,8 @@ in
collection tool. collection tool.
With the default configuration, ntopng monitors all network With the default configuration, ntopng monitors all network
interfaces and displays its findings at http://localhost:${toString interfaces and displays its findings at http://localhost:''${toString
cfg.http-port}. Default username and password is admin/admin. config.${opt.http-port}}. Default username and password is admin/admin.
See the ntopng(8) manual page and http://www.ntop.org/products/ntop/ See the ntopng(8) manual page and http://www.ntop.org/products/ntop/
for more info. for more info.

View file

@ -33,7 +33,7 @@ in
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
description = '' description = ''
Groups to which the user ${name} should be added. Groups to which the service user should be added.
''; '';
}; };

View file

@ -83,7 +83,7 @@ in {
default = "${user}.${fqdn}"; default = "${user}.${fqdn}";
example = "matomo.yourdomain.org"; example = "matomo.yourdomain.org";
description = '' 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. run Matomo on a different URL than matomo.yourdomain.
''; '';
}; };