about summary refs log tree commit diff
path: root/lib/default.nix
diff options
context:
space:
mode:
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