about summary refs log tree commit diff
path: root/modules/plausible.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2025-02-17 02:21:56 +0300
committerazahi <azat@bahawi.net>2025-02-17 02:21:56 +0300
commit59180328cda59817d71cd58c8f48ead047375064 (patch)
tree2cdd7d1bfa309839ef624c19daf283f510aacf69 /modules/plausible.nix
parent2025-02-05 (diff)
2025-02-17
Diffstat (limited to '')
-rw-r--r--modules/plausible.nix34
1 files changed, 17 insertions, 17 deletions
diff --git a/modules/plausible.nix b/modules/plausible.nix
index e910986..94e0d9d 100644
--- a/modules/plausible.nix
+++ b/modules/plausible.nix
@@ -5,23 +5,22 @@
   this,
   ...
 }:
-with lib;
 let
   cfg = config.nixfiles.modules.plausible;
 in
 {
   options.nixfiles.modules.plausible = {
-    enable = mkEnableOption "Plausible Analytics";
+    enable = lib.mkEnableOption "Plausible Analytics";
 
-    port = mkOption {
+    port = lib.mkOption {
       description = "Port.";
-      type = with types; port;
+      type = lib.types.port;
       default = 8000;
     };
 
-    domain = mkOption {
+    domain = lib.mkOption {
       description = "Domain name sans protocol scheme.";
-      type = with types; nullOr str;
+      type = with lib.types; nullOr str;
       default = "plausible.${config.networking.domain}";
     };
   };
@@ -30,7 +29,7 @@ in
     let
       db = "plausible";
     in
-    mkIf cfg.enable {
+    lib.mkIf cfg.enable {
       _module.args.libPlausible = {
         htmlPlausibleScript =
           {
@@ -88,12 +87,12 @@ in
         # };
 
         mail = {
-          email = "plausible@${my.domain.shire}";
+          email = "webmaster@${lib.my.domain.shire}";
           smtp = {
-            hostAddr = my.domain.shire;
+            hostAddr = lib.my.domain.shire;
             hostPort = 465;
             enableSSL = true;
-            user = "azahi@${my.domain.shire}";
+            user = "azahi@${lib.my.domain.shire}";
             passwordFile = config.secrets.plausible-smtp-password.path;
           };
         };
@@ -127,13 +126,14 @@ in
         requires = after;
       };
 
-      topology = with cfg; {
-        nodes.${this.hostname}.services.plausible = {
-          name = "Plausible";
-          icon = "${inputs.homelab-svg-assets}/assets/plausible.svg";
-          info = domain;
-          details.listen.text = "${config.services.plausible.server.listenAddress}:${toString port}";
-        };
+      topology.nodes.${this.hostname}.services.plausible = {
+        name = "Plausible";
+        icon = "${inputs.homelab-svg-assets}/assets/plausible.svg";
+        info = cfg.domain;
+        details.listen.text = lib.concatStringsSep ":" [
+          config.services.plausible.server.listenAddress
+          (toString cfg.port)
+        ];
       };
     };
 }

Consider giving Nix/NixOS a try! <3