about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-10-29 15:43:07 +0300
committerAzat Bahawi <azat@bahawi.net>2023-10-29 15:43:07 +0300
commit26125aac992416df8a3fd1f860aabcf6a37380ba (patch)
tree11ecb98248812a2b8392f3a879199835a55e9ee6 /lib
parent2023-10-25 (diff)
2023-10-29
Diffstat (limited to '')
-rw-r--r--lib/default.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 4251f7e..be32e60 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -28,11 +28,19 @@ lib: _: rec {
     assert min <= ini && ini <= max;
       lib.concatMapStrings (x: toString x + " ") (map (pow 2) [min ini max]);
 
-  # TODO Move this to the NGINX module.
+  # TODO Move these to the NGINX module.
   nginxInternalOnly = ''
     if ($internal != 1) {
       return 403;
     }
     access_log off;
   '';
+  nginxAppendHead = text: ''
+    sub_filter '</head>' '${lib.concatStrings text}</head>';
+    sub_filter_once on;
+  '';
+  htmlPlausibleScript = {
+    domain ? "$host",
+    src ? "https://plausible.shire.net/js/script.js",
+  }: ''<script defer data-domain="${domain}" src="${src}"></script>'';
 }

Consider giving Nix/NixOS a try! <3