From 26125aac992416df8a3fd1f860aabcf6a37380ba Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 29 Oct 2023 15:43:07 +0300 Subject: 2023-10-29 --- nixosConfigurations/manwe/webserver.nix | 79 +++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 14 deletions(-) (limited to 'nixosConfigurations/manwe') 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 '' - ''; - sub_filter_once on; - ''; + extraConfig = nginxAppendHead [(htmlPlausibleScript {domain = azahi;})]; }; }; } -- cgit v1.2.3