summary refs log tree commit diff
path: root/nixos/modules/services/web-apps/matomo.nix
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2021-12-05 22:56:22 +0100
committerpennae <github@quasiparticle.net>2021-12-09 01:42:24 +0100
commite67a646a925bc3cda86101a3f3afb81db3030ef5 (patch)
treefc91f2996187c22215a45c494a4fd21aba960db6 /nixos/modules/services/web-apps/matomo.nix
parent1f960e7571d46bd13dd4b5865f115467e100ef7d (diff)
downloadnixpkgs-e67a646a925bc3cda86101a3f3afb81db3030ef5.tar
nixpkgs-e67a646a925bc3cda86101a3f3afb81db3030ef5.tar.gz
nixpkgs-e67a646a925bc3cda86101a3f3afb81db3030ef5.tar.bz2
nixpkgs-e67a646a925bc3cda86101a3f3afb81db3030ef5.tar.lz
nixpkgs-e67a646a925bc3cda86101a3f3afb81db3030ef5.tar.xz
nixpkgs-e67a646a925bc3cda86101a3f3afb81db3030ef5.tar.zst
nixpkgs-e67a646a925bc3cda86101a3f3afb81db3030ef5.zip
treewide: add defaultText to remaining options
these are mostly options that use alias bindings, bindings to constants,
or bindings to calculated values.
Diffstat (limited to 'nixos/modules/services/web-apps/matomo.nix')
-rw-r--r--nixos/modules/services/web-apps/matomo.nix12
1 files changed, 7 insertions, 5 deletions
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