about summary refs log tree commit diff
path: root/nixosConfigurations/manwe
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 /nixosConfigurations/manwe
parent2023-10-25 (diff)
2023-10-29
Diffstat (limited to '')
-rw-r--r--nixosConfigurations/manwe/webserver.nix79
1 files changed, 65 insertions, 14 deletions
diff --git a/nixosConfigurations/manwe/webserver.nix b/nixosConfigurations/manwe/webserver.nix
index 6f8e088..5ea2418 100644
--- a/nixosConfigurations/manwe/webserver.nix
+++ b/nixosConfigurations/manwe/webserver.nix
@@ -1,7 +1,6 @@
 {
   inputs,
   lib,
-  pkgs,
   ...
 }:
 with lib; {
@@ -9,14 +8,70 @@ with lib; {
     enable = true;
     virtualHosts = with my.domain;
       {
-        # TODO Use a Self-signed certificate.
-        # TODO Allow overriding config.json, possibly via NGINX itself.
-        "start.local" = {
-          root = pkgs.hiccup;
-          locations."/".tryFiles = "$uri $uri/ /index.html";
-          enableACME = false;
-          forceSSL = false;
-        };
+        # TODO Start using this.
+        # "start.local" = {
+        #   root = pkgs.hiccup;
+        #   locations = {
+        #     "/".tryFiles = "$uri $uri/ /index.html";
+        #     "~* ^.+config.json$".extraConfig = let
+        #       config = pkgs.writeText "config.json" (generators.toJSON {} {
+        #         version = "2.0";
+        #         id = "default";
+        #         title = "Demo Config";
+        #         url = "./configs/config.json";
+        #         featured = [
+        #           {
+        #             name = "GitHub";
+        #             background = "/assets/card.png";
+        #             link = "https://github.com/ashwin-pc/hiccup";
+        #           }
+        #         ];
+        #         categories = [
+        #           {
+        #             title = "Category 1";
+        #             links = [
+        #               {
+        #                 name = "Link 1";
+        #                 link = "https://example.com";
+        #               }
+        #             ];
+        #           }
+        #           {
+        #             title = "Category 2";
+        #             links = [
+        #               {
+        #                 name = "Link 1";
+        #                 link = "https://example.com";
+        #               }
+        #             ];
+        #           }
+        #           {
+        #             title = "Category 3";
+        #             links = [
+        #               {
+        #                 name = "Link 1";
+        #                 link = "https://example.com";
+        #               }
+        #             ];
+        #           }
+        #           {
+        #             title = "Category 4";
+        #             links = [
+        #               {
+        #                 name = "Link 1";
+        #                 link = "https://example.com";
+        #               }
+        #             ];
+        #           }
+        #         ];
+        #       });
+        #     in ''
+        #       alias ${config};
+        #     '';
+        #   };
+        #   enableACME = false;
+        #   forceSSL = false;
+        # };
         ${shire}.locations."/".return = "301 https://www.youtube.com/watch?v=dQw4w9WgXcQ";
         "git.${shire}".locations."/".return = "301 https://git.${azahi}";
         "bitwarden.${shire}".locations."/".return = "301 https://vaultwarden.${shire}";
@@ -24,11 +79,7 @@ with lib; {
           serverAliases = ["frodo.${gondor}" "frodo.${rohan}"];
           locations."/" = {
             root = inputs.azahi-cc;
-            extraConfig = ''
-              sub_filter '</head>'
-                  '<script defer data-domain="${azahi}" src="https://plausible.shire.net/js/script.js"></script></head>';
-              sub_filter_once on;
-            '';
+            extraConfig = nginxAppendHead [(htmlPlausibleScript {domain = azahi;})];
           };
         };
       }

Consider giving Nix/NixOS a try! <3