From e67a646a925bc3cda86101a3f3afb81db3030ef5 Mon Sep 17 00:00:00 2001 From: pennae Date: Sun, 5 Dec 2021 22:56:22 +0100 Subject: treewide: add defaultText to remaining options these are mostly options that use alias bindings, bindings to constants, or bindings to calculated values. --- nixos/modules/services/web-apps/galene.nix | 6 +++++- nixos/modules/services/web-apps/invidious.nix | 1 + nixos/modules/services/web-apps/matomo.nix | 12 +++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) (limited to 'nixos/modules/services/web-apps') diff --git a/nixos/modules/services/web-apps/galene.nix b/nixos/modules/services/web-apps/galene.nix index db9dfeb4749..1d0a620585b 100644 --- a/nixos/modules/services/web-apps/galene.nix +++ b/nixos/modules/services/web-apps/galene.nix @@ -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."; }; diff --git a/nixos/modules/services/web-apps/invidious.nix b/nixos/modules/services/web-apps/invidious.nix index 7fb826af583..696fd7466f4 100644 --- a/nixos/modules/services/web-apps/invidious.nix +++ b/nixos/modules/services/web-apps/invidious.nix @@ -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. diff --git a/nixos/modules/services/web-apps/matomo.nix b/nixos/modules/services/web-apps/matomo.nix index 318c4473b55..8a0ca33b51f 100644 --- a/nixos/modules/services/web-apps/matomo.nix +++ b/nixos/modules/services/web-apps/matomo.nix @@ -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 -- cgit 1.4.1