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

treewide: add defaultText for options with simple interpolation defaults

adds defaultText for all options that use `cfg.*` values in their
defaults, but only for interpolations with no extra processing (other
than toString where necessary)
This commit is contained in:
pennae 2021-12-05 21:28:49 +01:00
parent f6d0b014fe
commit fb0e5be843
31 changed files with 136 additions and 29 deletions

View file

@ -1,6 +1,7 @@
{ config, lib, pkgs, ...}: { config, lib, options, pkgs, ...}:
let let
cfg = config.services.hadoop; cfg = config.services.hadoop;
opt = options.services.hadoop;
in in
with lib; with lib;
{ {
@ -44,6 +45,14 @@ with lib;
"mapreduce.map.env" = "HADOOP_MAPRED_HOME=${cfg.package}/lib/${cfg.package.untarDir}"; "mapreduce.map.env" = "HADOOP_MAPRED_HOME=${cfg.package}/lib/${cfg.package.untarDir}";
"mapreduce.reduce.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; type = types.attrsOf types.anything;
example = literalExpression '' example = literalExpression ''
options.services.hadoop.mapredSite.default // { options.services.hadoop.mapredSite.default // {
@ -98,6 +107,9 @@ with lib;
log4jProperties = mkOption { log4jProperties = mkOption {
default = "${cfg.package}/lib/${cfg.package.untarDir}/etc/hadoop/log4j.properties"; 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; type = types.path;
example = literalExpression '' example = literalExpression ''
"''${pkgs.hadoop}/lib/''${pkgs.hadoop.untarDir}/etc/hadoop/log4j.properties"; "''${pkgs.hadoop}/lib/''${pkgs.hadoop.untarDir}/etc/hadoop/log4j.properties";

View file

@ -1,11 +1,12 @@
# NixOS module for Buildbot continous integration server. # NixOS module for Buildbot continous integration server.
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.buildbot-master; cfg = config.services.buildbot-master;
opt = options.services.buildbot-master;
python = cfg.package.pythonModule; python = cfg.package.pythonModule;
@ -152,6 +153,7 @@ in {
buildbotDir = mkOption { buildbotDir = mkOption {
default = "${cfg.home}/master"; default = "${cfg.home}/master";
defaultText = literalExpression ''"''${config.${opt.home}}/master"'';
type = types.path; type = types.path;
description = "Specifies the Buildbot directory."; description = "Specifies the Buildbot directory.";
}; };

View file

@ -1,11 +1,12 @@
# NixOS module for Buildbot Worker. # NixOS module for Buildbot Worker.
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.buildbot-worker; cfg = config.services.buildbot-worker;
opt = options.services.buildbot-worker;
python = cfg.package.pythonModule; python = cfg.package.pythonModule;
@ -77,6 +78,7 @@ in {
buildbotDir = mkOption { buildbotDir = mkOption {
default = "${cfg.home}/worker"; default = "${cfg.home}/worker";
defaultText = literalExpression ''"''${config.${opt.home}}/worker"'';
type = types.path; type = types.path;
description = "Specifies the Buildbot directory."; description = "Specifies the Buildbot directory.";
}; };

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.gocd-agent; cfg = config.services.gocd-agent;
opt = options.services.gocd-agent;
in { in {
options = { options = {
services.gocd-agent = { services.gocd-agent = {
@ -98,6 +99,15 @@ in {
"-Dcruise.console.publish.interval=10" "-Dcruise.console.publish.interval=10"
"-Djava.security.egd=file:/dev/./urandom" "-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 = '' description = ''
Specifies startup command line arguments to pass to Go.CD agent Specifies startup command line arguments to pass to Go.CD agent
java process. java process.

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.gocd-server; cfg = config.services.gocd-server;
opt = options.services.gocd-server;
in { in {
options = { options = {
services.gocd-server = { services.gocd-server = {
@ -106,6 +107,20 @@ in {
"-Dcruise.server.port=${toString cfg.port}" "-Dcruise.server.port=${toString cfg.port}"
"-Dcruise.server.ssl.port=${toString cfg.sslPort}" "-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 = '' description = ''
Specifies startup command line arguments to pass to Go.CD server Specifies startup command line arguments to pass to Go.CD server

View file

@ -4,6 +4,7 @@ with lib;
let let
cfg = config.services.neo4j; cfg = config.services.neo4j;
opt = options.services.neo4j;
certDirOpt = options.services.neo4j.directories.certificates; certDirOpt = options.services.neo4j.directories.certificates;
isDefaultPathOption = opt: isOption opt && opt.type == types.path && opt.highestPrio >= 1500; isDefaultPathOption = opt: isOption opt && opt.type == types.path && opt.highestPrio >= 1500;
@ -256,6 +257,7 @@ in {
certificates = mkOption { certificates = mkOption {
type = types.path; type = types.path;
default = "${cfg.directories.home}/certificates"; default = "${cfg.directories.home}/certificates";
defaultText = literalExpression ''"''${config.${opt.directories.home}}/certificates"'';
description = '' description = ''
Directory for storing certificates to be used by Neo4j for Directory for storing certificates to be used by Neo4j for
TLS connections. TLS connections.
@ -280,6 +282,7 @@ in {
data = mkOption { data = mkOption {
type = types.path; type = types.path;
default = "${cfg.directories.home}/data"; default = "${cfg.directories.home}/data";
defaultText = literalExpression ''"''${config.${opt.directories.home}}/data"'';
description = '' description = ''
Path of the data directory. You must not configure more than one Path of the data directory. You must not configure more than one
Neo4j installation to use the same data directory. Neo4j installation to use the same data directory.
@ -305,6 +308,7 @@ in {
imports = mkOption { imports = mkOption {
type = types.path; type = types.path;
default = "${cfg.directories.home}/import"; default = "${cfg.directories.home}/import";
defaultText = literalExpression ''"''${config.${opt.directories.home}}/import"'';
description = '' description = ''
The root directory for file URLs used with the Cypher The root directory for file URLs used with the Cypher
<literal>LOAD CSV</literal> clause. Only meaningful when <literal>LOAD CSV</literal> clause. Only meaningful when
@ -321,6 +325,7 @@ in {
plugins = mkOption { plugins = mkOption {
type = types.path; type = types.path;
default = "${cfg.directories.home}/plugins"; default = "${cfg.directories.home}/plugins";
defaultText = literalExpression ''"''${config.${opt.directories.home}}/plugins"'';
description = '' description = ''
Path of the database plugin directory. Compiled Java JAR files that Path of the database plugin directory. Compiled Java JAR files that
contain database procedures will be loaded if they are placed in contain database procedures will be loaded if they are placed in

View file

@ -1,11 +1,12 @@
# tcsd daemon. # tcsd daemon.
{ config, pkgs, lib, ... }: { config, options, pkgs, lib, ... }:
with lib; with lib;
let let
cfg = config.services.tcsd; cfg = config.services.tcsd;
opt = options.services.tcsd;
tcsdConf = pkgs.writeText "tcsd.conf" '' tcsdConf = pkgs.writeText "tcsd.conf" ''
port = 30003 port = 30003
@ -83,6 +84,7 @@ in
platformCred = mkOption { platformCred = mkOption {
default = "${cfg.stateDir}/platform.cert"; default = "${cfg.stateDir}/platform.cert";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/platform.cert"'';
type = types.path; type = types.path;
description = '' description = ''
Path to the platform credential for your TPM. Your TPM Path to the platform credential for your TPM. Your TPM
@ -96,6 +98,7 @@ in
conformanceCred = mkOption { conformanceCred = mkOption {
default = "${cfg.stateDir}/conformance.cert"; default = "${cfg.stateDir}/conformance.cert";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/conformance.cert"'';
type = types.path; type = types.path;
description = '' description = ''
Path to the conformance credential for your TPM. Path to the conformance credential for your TPM.
@ -104,6 +107,7 @@ in
endorsementCred = mkOption { endorsementCred = mkOption {
default = "${cfg.stateDir}/endorsement.cert"; default = "${cfg.stateDir}/endorsement.cert";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/endorsement.cert"'';
type = types.path; type = types.path;
description = '' description = ''
Path to the endorsement credential for your TPM. Path to the endorsement credential for your TPM.

View file

@ -50,6 +50,7 @@ in {
initialCluster = mkOption { initialCluster = mkOption {
description = "Etcd initial cluster configuration for bootstrapping."; description = "Etcd initial cluster configuration for bootstrapping.";
default = ["${cfg.name}=http://127.0.0.1:2380"]; 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; type = types.listOf types.str;
}; };

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.exhibitor; cfg = config.services.exhibitor;
opt = options.services.exhibitor;
exhibitorConfig = '' exhibitorConfig = ''
zookeeper-install-directory=${cfg.baseDir}/zookeeper zookeeper-install-directory=${cfg.baseDir}/zookeeper
zookeeper-data-directory=${cfg.zkDataDir} zookeeper-data-directory=${cfg.zkDataDir}
@ -165,6 +166,7 @@ in
zkDataDir = mkOption { zkDataDir = mkOption {
type = types.str; type = types.str;
default = "${cfg.baseDir}/zkData"; default = "${cfg.baseDir}/zkData";
defaultText = literalExpression ''"''${config.${opt.baseDir}}/zkData"'';
description = '' description = ''
The Zookeeper data directory The Zookeeper data directory
''; '';
@ -172,6 +174,7 @@ in
zkLogDir = mkOption { zkLogDir = mkOption {
type = types.path; type = types.path;
default = "${cfg.baseDir}/zkLogs"; default = "${cfg.baseDir}/zkLogs";
defaultText = literalExpression ''"''${config.${opt.baseDir}}/zkLogs"'';
description = '' description = ''
The Zookeeper logs directory The Zookeeper logs directory
''; '';

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.gitea; cfg = config.services.gitea;
opt = options.services.gitea;
gitea = cfg.package; gitea = cfg.package;
pg = config.services.postgresql; pg = config.services.postgresql;
useMysql = cfg.database.type == "mysql"; useMysql = cfg.database.type == "mysql";
@ -51,6 +52,7 @@ in
log = { log = {
rootPath = mkOption { rootPath = mkOption {
default = "${cfg.stateDir}/log"; default = "${cfg.stateDir}/log";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/log"'';
type = types.str; type = types.str;
description = "Root path for log files."; description = "Root path for log files.";
}; };
@ -130,6 +132,7 @@ in
path = mkOption { path = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/data/gitea.db"; default = "${cfg.stateDir}/data/gitea.db";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/data/gitea.db"'';
description = "Path to the sqlite3 database file."; description = "Path to the sqlite3 database file.";
}; };
@ -166,6 +169,7 @@ in
backupDir = mkOption { backupDir = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/dump"; default = "${cfg.stateDir}/dump";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/dump"'';
description = "Path to the dump files."; description = "Path to the dump files.";
}; };
}; };
@ -199,6 +203,7 @@ in
contentDir = mkOption { contentDir = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/data/lfs"; default = "${cfg.stateDir}/data/lfs";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/data/lfs"'';
description = "Where to store LFS files."; description = "Where to store LFS files.";
}; };
}; };
@ -212,6 +217,7 @@ in
repositoryRoot = mkOption { repositoryRoot = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/repositories"; default = "${cfg.stateDir}/repositories";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/repositories"'';
description = "Path to the git repositories."; description = "Path to the git repositories.";
}; };

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.gogs; cfg = config.services.gogs;
opt = options.services.gogs;
configFile = pkgs.writeText "app.ini" '' configFile = pkgs.writeText "app.ini" ''
APP_NAME = ${cfg.appName} APP_NAME = ${cfg.appName}
RUN_USER = ${cfg.user} RUN_USER = ${cfg.user}
@ -129,6 +130,7 @@ in
path = mkOption { path = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/data/gogs.db"; default = "${cfg.stateDir}/data/gogs.db";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/data/gogs.db"'';
description = "Path to the sqlite3 database file."; description = "Path to the sqlite3 database file.";
}; };
}; };
@ -142,6 +144,7 @@ in
repositoryRoot = mkOption { repositoryRoot = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/repositories"; default = "${cfg.stateDir}/repositories";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/repositories"'';
description = "Path to the git repositories."; description = "Path to the git repositories.";
}; };

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
@ -7,6 +7,7 @@ let
name = "headphones"; name = "headphones";
cfg = config.services.headphones; cfg = config.services.headphones;
opt = options.services.headphones;
in in
@ -29,6 +30,7 @@ in
configFile = mkOption { configFile = mkOption {
type = types.path; type = types.path;
default = "${cfg.dataDir}/config.ini"; default = "${cfg.dataDir}/config.ini";
defaultText = literalExpression ''"''${config.${opt.dataDir}}/config.ini"'';
description = "Path to config file."; description = "Path to config file.";
}; };
host = mkOption { host = mkOption {

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }: { config, options, pkgs, lib, ... }:
with lib; with lib;
@ -7,6 +7,7 @@ let
registrationFile = "${dataDir}/discord-registration.yaml"; registrationFile = "${dataDir}/discord-registration.yaml";
appDir = "${pkgs.matrix-appservice-discord}/${pkgs.matrix-appservice-discord.passthru.nodeAppDir}"; appDir = "${pkgs.matrix-appservice-discord}/${pkgs.matrix-appservice-discord.passthru.nodeAppDir}";
cfg = config.services.matrix-appservice-discord; cfg = config.services.matrix-appservice-discord;
opt = options.services.matrix-appservice-discord;
# TODO: switch to configGen.json once RFC42 is implemented # TODO: switch to configGen.json once RFC42 is implemented
settingsFile = pkgs.writeText "matrix-appservice-discord-settings.json" (builtins.toJSON cfg.settings); settingsFile = pkgs.writeText "matrix-appservice-discord-settings.json" (builtins.toJSON cfg.settings);
@ -74,6 +75,7 @@ in {
url = mkOption { url = mkOption {
type = types.str; type = types.str;
default = "http://localhost:${toString cfg.port}"; default = "http://localhost:${toString cfg.port}";
defaultText = literalExpression ''"http://localhost:''${toString config.${opt.port}}"'';
description = '' description = ''
The URL where the application service is listening for HS requests. The URL where the application service is listening for HS requests.
''; '';

View file

@ -47,6 +47,9 @@ in
qserve = mkOption { qserve = mkOption {
default = [ "${cfg.qserve.address}:${toString cfg.qserve.port}" ]; default = [ "${cfg.qserve.address}:${toString cfg.qserve.port}" ];
defaultText = literalExpression ''
[ "''${config.${opt.qserve.address}}:''${toString config.${opt.qserve.port}}"
]'';
type = types.listOf types.str; type = types.listOf types.str;
description = "Register qserve instance."; description = "Register qserve instance.";
}; # nserve.qserve }; # nserve.qserve
@ -129,7 +132,7 @@ in
You have to enable it, or use your own way for serving files You have to enable it, or use your own way for serving files
and set the http.url option accordingly. and set the http.url option accordingly.
''; '';
type = types.submodule ({ type = types.submodule ({ config, options, ... }: {
options = { options = {
enable = mkOption { enable = mkOption {
default = true; default = true;
@ -150,7 +153,8 @@ in
}; # nslave.http.address }; # nslave.http.address
url = mkOption { 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; type = types.str;
description = '' description = ''
Specify URL for accessing generated files from cache. Specify URL for accessing generated files from cache.

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
@ -7,6 +7,7 @@ let
name = "sickbeard"; name = "sickbeard";
cfg = config.services.sickbeard; cfg = config.services.sickbeard;
opt = options.services.sickbeard;
sickbeard = cfg.package; sickbeard = cfg.package;
in in
@ -39,6 +40,7 @@ in
configFile = mkOption { configFile = mkOption {
type = types.path; type = types.path;
default = "${cfg.dataDir}/config.ini"; default = "${cfg.dataDir}/config.ini";
defaultText = literalExpression ''"''${config.${opt.dataDir}}/config.ini"'';
description = "Path to config file."; description = "Path to config file.";
}; };
port = mkOption { port = mkOption {

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
scfg = cfg.builds; scfg = cfg.builds;
rcfg = config.services.redis; rcfg = config.services.redis;
iniKey = "builds.sr.ht"; iniKey = "builds.sr.ht";
@ -38,6 +39,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/buildsrht"; default = "${cfg.statePath}/buildsrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/buildsrht"'';
description = '' description = ''
State path for builds.sr.ht. State path for builds.sr.ht.
''; '';

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
cfgIni = cfg.settings; cfgIni = cfg.settings;
scfg = cfg.dispatch; scfg = cfg.dispatch;
iniKey = "dispatch.sr.ht"; iniKey = "dispatch.sr.ht";
@ -38,6 +39,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/dispatchsrht"; default = "${cfg.statePath}/dispatchsrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/dispatchsrht"'';
description = '' description = ''
State path for dispatch.sr.ht. State path for dispatch.sr.ht.
''; '';

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
scfg = cfg.git; scfg = cfg.git;
iniKey = "git.sr.ht"; iniKey = "git.sr.ht";
@ -41,6 +42,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/gitsrht"; default = "${cfg.statePath}/gitsrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/gitsrht"'';
description = '' description = ''
State path for git.sr.ht. State path for git.sr.ht.
''; '';

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
scfg = cfg.hg; scfg = cfg.hg;
iniKey = "hg.sr.ht"; iniKey = "hg.sr.ht";
@ -40,6 +41,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/hgsrht"; default = "${cfg.statePath}/hgsrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/hgsrht"'';
description = '' description = ''
State path for hg.sr.ht. State path for hg.sr.ht.
''; '';

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
cfgIni = cfg.settings; cfgIni = cfg.settings;
scfg = cfg.hub; scfg = cfg.hub;
iniKey = "hub.sr.ht"; iniKey = "hub.sr.ht";
@ -38,6 +39,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/hubsrht"; default = "${cfg.statePath}/hubsrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/hubsrht"'';
description = '' description = ''
State path for hub.sr.ht. State path for hub.sr.ht.
''; '';

View file

@ -1,11 +1,12 @@
# Email setup is fairly involved, useful references: # Email setup is fairly involved, useful references:
# https://drewdevault.com/2018/08/05/Local-mail-server.html # https://drewdevault.com/2018/08/05/Local-mail-server.html
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
cfgIni = cfg.settings; cfgIni = cfg.settings;
scfg = cfg.lists; scfg = cfg.lists;
iniKey = "lists.sr.ht"; iniKey = "lists.sr.ht";
@ -42,6 +43,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/listssrht"; default = "${cfg.statePath}/listssrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/listssrht"'';
description = '' description = ''
State path for lists.sr.ht. State path for lists.sr.ht.
''; '';

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
cfgIni = cfg.settings; cfgIni = cfg.settings;
scfg = cfg.man; scfg = cfg.man;
iniKey = "man.sr.ht"; iniKey = "man.sr.ht";
@ -38,6 +39,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/mansrht"; default = "${cfg.statePath}/mansrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/mansrht"'';
description = '' description = ''
State path for man.sr.ht. State path for man.sr.ht.
''; '';

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
cfgIni = cfg.settings; cfgIni = cfg.settings;
scfg = cfg.meta; scfg = cfg.meta;
iniKey = "meta.sr.ht"; iniKey = "meta.sr.ht";
@ -39,6 +40,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/metasrht"; default = "${cfg.statePath}/metasrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/metasrht"'';
description = '' description = ''
State path for meta.sr.ht. State path for meta.sr.ht.
''; '';

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
cfgIni = cfg.settings; cfgIni = cfg.settings;
scfg = cfg.paste; scfg = cfg.paste;
iniKey = "paste.sr.ht"; iniKey = "paste.sr.ht";
@ -39,6 +40,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/pastesrht"; default = "${cfg.statePath}/pastesrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/pastesrht"'';
description = '' description = ''
State path for pastesrht.sr.ht. State path for pastesrht.sr.ht.
''; '';

View file

@ -1,8 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.sourcehut; cfg = config.services.sourcehut;
opt = options.services.sourcehut;
cfgIni = cfg.settings; cfgIni = cfg.settings;
scfg = cfg.todo; scfg = cfg.todo;
iniKey = "todo.sr.ht"; iniKey = "todo.sr.ht";
@ -39,6 +40,7 @@ in
statePath = mkOption { statePath = mkOption {
type = types.path; type = types.path;
default = "${cfg.statePath}/todosrht"; default = "${cfg.statePath}/todosrht";
defaultText = literalExpression ''"''${config.${opt.statePath}}/todosrht"'';
description = '' description = ''
State path for todo.sr.ht. State path for todo.sr.ht.
''; '';

View file

@ -404,6 +404,7 @@ in {
path = mkOption { path = mkOption {
description = "Database path."; description = "Database path.";
default = "${cfg.dataDir}/data/grafana.db"; default = "${cfg.dataDir}/data/grafana.db";
defaultText = literalExpression ''"''${config.${opt.dataDir}}/data/grafana.db"'';
type = types.path; type = types.path;
}; };

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.graphite; cfg = config.services.graphite;
opt = options.services.graphite;
writeTextOrNull = f: t: mapNullable (pkgs.writeTextDir f) t; writeTextOrNull = f: t: mapNullable (pkgs.writeTextDir f) t;
dataDir = cfg.dataDir; dataDir = cfg.dataDir;
@ -312,12 +313,14 @@ in {
seyrenUrl = mkOption { seyrenUrl = mkOption {
default = "http://localhost:${toString cfg.seyren.port}/"; default = "http://localhost:${toString cfg.seyren.port}/";
defaultText = literalExpression ''"http://localhost:''${toString config.${opt.seyren.port}}/"'';
description = "Host where seyren is accessible."; description = "Host where seyren is accessible.";
type = types.str; type = types.str;
}; };
graphiteUrl = mkOption { graphiteUrl = mkOption {
default = "http://${cfg.web.listenAddress}:${toString cfg.web.port}"; 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."; description = "Host where graphite service runs.";
type = types.str; type = types.str;
}; };

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.privacyidea; cfg = config.services.privacyidea;
opt = options.services.privacyidea;
uwsgi = pkgs.uwsgi.override { plugins = [ "python3" ]; }; uwsgi = pkgs.uwsgi.override { plugins = [ "python3" ]; };
python = uwsgi.python3; python = uwsgi.python3;
@ -112,6 +113,7 @@ in
encFile = mkOption { encFile = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/enckey"; default = "${cfg.stateDir}/enckey";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/enckey"'';
description = '' description = ''
This is used to encrypt the token data and token passwords This is used to encrypt the token data and token passwords
''; '';
@ -120,6 +122,7 @@ in
auditKeyPrivate = mkOption { auditKeyPrivate = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/private.pem"; default = "${cfg.stateDir}/private.pem";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/private.pem"'';
description = '' description = ''
Private Key for signing the audit log. Private Key for signing the audit log.
''; '';
@ -128,6 +131,7 @@ in
auditKeyPublic = mkOption { auditKeyPublic = mkOption {
type = types.str; type = types.str;
default = "${cfg.stateDir}/public.pem"; default = "${cfg.stateDir}/public.pem";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/public.pem"'';
description = '' description = ''
Public key for checking signatures of the audit log. Public key for checking signatures of the audit log.
''; '';

View file

@ -1,9 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, options, pkgs, ... }:
with lib; with lib;
let let
cfg = config.services.peerflix; cfg = config.services.peerflix;
opt = options.services.peerflix;
configFile = pkgs.writeText "peerflix-config.json" '' configFile = pkgs.writeText "peerflix-config.json" ''
{ {
@ -32,6 +33,7 @@ in {
downloadDir = mkOption { downloadDir = mkOption {
description = "Peerflix temporary download directory."; description = "Peerflix temporary download directory.";
default = "${cfg.stateDir}/torrents"; default = "${cfg.stateDir}/torrents";
defaultText = literalExpression ''"''${config.${opt.stateDir}}/torrents"'';
type = types.path; type = types.path;
}; };
}; };

View file

@ -1,10 +1,11 @@
{ config, pkgs, lib, ... }: { config, options, pkgs, lib, ... }:
with lib; with lib;
let let
cfg = config.services.rtorrent; cfg = config.services.rtorrent;
opt = options.services.rtorrent;
in { in {
options.services.rtorrent = { options.services.rtorrent = {
@ -21,6 +22,7 @@ in {
downloadDir = mkOption { downloadDir = mkOption {
type = types.str; type = types.str;
default = "${cfg.dataDir}/download"; default = "${cfg.dataDir}/download";
defaultText = literalExpression ''"''${config.${opt.dataDir}}/download"'';
description = '' description = ''
Where to put downloaded files. Where to put downloaded files.
''; '';

View file

@ -1,7 +1,8 @@
{ config, lib, pkgs, utils, ... }: { config, lib, options, pkgs, utils, ... }:
with lib; with lib;
let let
cfg = config.services.unifi-video; cfg = config.services.unifi-video;
opt = options.services.unifi-video;
mainClass = "com.ubnt.airvision.Main"; mainClass = "com.ubnt.airvision.Main";
cmd = '' cmd = ''
${pkgs.jsvc}/bin/jsvc \ ${pkgs.jsvc}/bin/jsvc \
@ -164,6 +165,7 @@ in
pidFile = mkOption { pidFile = mkOption {
type = types.path; type = types.path;
default = "${cfg.dataDir}/unifi-video.pid"; default = "${cfg.dataDir}/unifi-video.pid";
defaultText = literalExpression ''"''${config.${opt.dataDir}}/unifi-video.pid"'';
description = "Location of unifi-video pid file."; description = "Location of unifi-video pid file.";
}; };