Home

dotnix @718aea2b5ff8f2458645a46e66d17db5f6e23197 - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
dotnix / machines / dragonwell / caddy.nix
- raw
 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
{lib, ...}: let
  packages = ["tmpl" "git-age" "ffmd"];
in {
  services.caddy = {
    enable = true;
    virtualHosts = {
      "jolheiser.com" = {
        extraConfig = ''
          root * /srv/jolheiser.com/dist
          file_server
        '';
        serverAliases = ["www.jolheiser.com"];
      };
      "go.jolheiser.com" = {
        extraConfig =
          ''
            header Content-Type text/html
            respond / `<html><head><title>Go Packages</title></head><body><ul>${lib.strings.concatMapStrings (pkg: "<li><a href=\"${pkg}\">${pkg}</a></li>") packages}</ul></body></html>`
          ''
          + lib.strings.concatMapStrings (pkg: ''
            respond /${pkg}* `<html><head>
            <meta name="go-import" content="git.jojodev.com/jolheiser/${pkg} git https://git.jojodev.com/jolheiser/${pkg}.git">
            <meta http-equiv="refresh" content="3; url=https://pkg.go.dev/go.jolheiser.com/${pkg}" />
            </head><body>
            Redirecting to <a href="https://pkg.go.dev/go.jolheiser.com/${pkg}">https://pkg.go.dev/go.jolheiser.com/${pkg}</a>
            </body></html>`
          '')
          packages;
      };
    };
  };
}