about summary refs log tree commit diff
path: root/modules/nixos/plausible.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/plausible.nix27
1 files changed, 16 insertions, 11 deletions
diff --git a/modules/nixos/plausible.nix b/modules/nixos/plausible.nix
index 8de54d2..d63e3ab 100644
--- a/modules/nixos/plausible.nix
+++ b/modules/nixos/plausible.nix
@@ -4,9 +4,11 @@
   lib,
   ...
 }:
-with lib; let
+with lib;
+let
   cfg = config.nixfiles.modules.plausible;
-in {
+in
+{
   options.nixfiles.modules.plausible = {
     enable = mkEnableOption "Plausible Analytics";
 
@@ -23,15 +25,18 @@ in {
     };
   };
 
-  config = let
-    db = "plausible";
-  in
+  config =
+    let
+      db = "plausible";
+    in
     mkIf cfg.enable {
       _module.args.libPlausible = {
-        htmlPlausibleScript = {
-          domain ? "$host",
-          src ? "https://${cfg.domain}/js/script.js",
-        }: ''<script defer data-domain="${domain}" src="${src}"></script>'';
+        htmlPlausibleScript =
+          {
+            domain ? "$host",
+            src ? "https://${cfg.domain}/js/script.js",
+          }:
+          ''<script defer data-domain="${domain}" src="${src}"></script>'';
       };
 
       secrets = {
@@ -43,7 +48,7 @@ in {
       nixfiles.modules = {
         nginx = {
           enable = true;
-          upstreams.plausible.servers."127.0.0.1:${toString cfg.port}" = {};
+          upstreams.plausible.servers."127.0.0.1:${toString cfg.port}" = { };
           virtualHosts.${cfg.domain}.locations."/" = {
             proxyPass = "http://plausible";
             proxyWebsockets = true;
@@ -62,7 +67,7 @@ in {
       };
 
       services.postgresql = {
-        ensureDatabases = [db];
+        ensureDatabases = [ db ];
         ensureUsers = [
           {
             name = db;

Consider giving Nix/NixOS a try! <3