treewide: set defaultText for options using simple path defaults

adds defaultText for all options that set their default to a path expression
using the ubiquitous `cfg` shortcut bindings.
This commit is contained in:
pennae
2021-12-05 20:40:24 +01:00
parent 70b105d1d0
commit e24a8775a8
21 changed files with 79 additions and 23 deletions

View File

@@ -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";
@@ -89,6 +90,7 @@ in
storageUser = mkOption {
type = types.str;
default = cfg.user;
defaultText = literalExpression "config.${opt.user}";
description = ''
Database user name.
'';
@@ -153,6 +155,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