about summary refs log tree commit diff
path: root/configurations/manwe/webserver.nix
blob: 051ddba03af20aaeb16d371cd9935562ff581cf6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{
  inputs,
  lib,
  libNginx,
  libPlausible,
  ...
}:
with lib;
{
  nixfiles.modules.nginx = {
    enable = true;
    virtualHosts =
      with my.domain;
      {
        ${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}";
        ${azahi} = {
          serverAliases = [
            "frodo.${gondor}"
            "frodo.${rohan}"
          ];
          locations."/" = {
            root = inputs.azahi-cc;
            extraConfig = libNginx.config.appendHead [ (libPlausible.htmlPlausibleScript { domain = azahi; }) ];
          };
        };
      }
      // (
        let
          frodo = "301 https://frodo.";
        in
        {
          ${gondor}.locations."/".return = concatStrings [
            frodo
            gondor
          ];
          ${rohan}.locations."/".return = concatStrings [
            frodo
            rohan
          ];
        }
      );
  };
}

Consider giving Nix/NixOS a try! <3