treewide: add defaultText for options using other shortcut bindings

This commit is contained in:
pennae 2021-12-05 22:36:38 +01:00
parent 3226c5aded
commit 9407761763
6 changed files with 25 additions and 5 deletions

View file

@ -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}
@ -65,6 +66,7 @@ in
keyfile = mkOption {
type = types.str;
default = gcfg.keyfile;
defaultText = literalExpression "config.${opt.keyfile}";
description = ''
Set a specific keyfile for this archive. This defaults to
<literal>"/root/tarsnap.key"</literal> if left unspecified.

View file

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

View file

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

View file

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

View file

@ -148,6 +148,7 @@ in
xauthBin = mkOption {
internal = true;
default = "${xorg.xauth}/bin/xauth";
defaultText = literalExpression ''"''${pkgs.xorg.xauth}/bin/xauth"'';
description = "Path to the <command>xauth</command> program used by display managers.";
};

View file

@ -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;
@ -347,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 {