dotnix/machines/dragonwell/caddy.nix

79 lines
2.3 KiB
Nix

{pkgs, ...}: let
modules = import ./go.nix;
in {
services.caddy = {
enable = true;
virtualHosts = {
"jolheiser.com" = {
extraConfig = ''
handle_path /.well-known/webfinger {
header Content-Type application/jrd+json
respond ${builtins.toJSON {
subject = "acct:john@jolheiser.com";
links = [
{
rel = "http://openid.net/specs/connect/1.0/issuer";
href = "https://auth.jolheiser.com";
}
];
}}
}
handle_path /bennet* {
root * ${pkgs.jolheiser.bennet}
file_server
}
handle /resume* {
root * ${pkgs.jolheiser.resume}
rewrite /resume /resume.pdf
file_server
}
handle {
root * ${pkgs.jolheiser.website}
file_server
}
'';
serverAliases = ["www.jolheiser.com"];
};
"blog.jolheiser.com" = {
extraConfig = ''
root * ${pkgs.jolheiser.blog}
file_server
'';
};
"go.jolheiser.com" = {
extraConfig = ''
header Content-Type text/html
${modules}
respond /* `<html><head>
<meta name="go-import" content="go.jolheiser.com{path} git https://git.jojodev.com/jolheiser{path}.git">
<meta http-equiv="refresh" content="3; url=https://pkg.go.dev/go.jolheiser.com{path}" />
</head><body>
Redirecting to <a href="https://pkg.go.dev/go.jolheiser.com{path}">https://pkg.go.dev/go.jolheiser.com{path}</a>
</body></html>`
'';
};
"git.jolheiser.com".extraConfig = ''
reverse_proxy localhost:8449
'';
"pr.jolheiser.com".extraConfig = ''
reverse_proxy localhost:7449
'';
"social.jolheiser.com".extraConfig = ''
reverse_proxy localhost:4686
'';
"auth.jolheiser.com".extraConfig = ''
reverse_proxy localhost:2884
'';
"todo.jolheiser.com".extraConfig = ''
reverse_proxy localhost:8636
'';
"recipes.jolheiser.com".extraConfig = ''
reverse_proxy localhost:3663
'';
"irc.jolheiser.com".extraConfig = ''
reverse_proxy localhost:7658
'';
};
};
}