3
0
Fork 0
forked from mirrors/nixpkgs

treewide: add defaultText to remaining options

these are mostly options that use alias bindings, bindings to constants,
or bindings to calculated values.
This commit is contained in:
pennae 2021-12-05 22:56:22 +01:00
parent 1f960e7571
commit e67a646a92
10 changed files with 45 additions and 9 deletions

View file

@ -86,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.";
};

View file

@ -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.
'';

View file

@ -172,6 +172,13 @@ in {
directories:
- ${dataDir}/whisper
'';
defaultText = literalExpression ''
'''
whisper:
directories:
- ''${config.${opt.dataDir}}/whisper
'''
'';
example = ''
allowed_origins:
- dashboard.example.com

View file

@ -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.
'';

View file

@ -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.

View file

@ -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 {

View file

@ -186,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.";
});

View file

@ -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.";
};

View file

@ -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.

View file

@ -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,6 +78,11 @@ 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. You may want to change it if you