feat: dragonwell caddy

Signed-off-by: jolheiser <john.olheiser@gmail.com>
teamcity
jolheiser 2023-09-01 22:22:33 -05:00
parent f4a029043f
commit 718aea2b5f
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
2 changed files with 38 additions and 3 deletions

View File

@ -0,0 +1,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;
};
};
};
}

View File

@ -1,7 +1,7 @@
{pkgs, ...}: let
let
username = "jolheiser";
in {
imports = [./hardware.nix ../common/nogui];
imports = [./caddy.nix ./hardware.nix ../common/nogui];
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
@ -9,7 +9,10 @@ in {
networking = {
hostName = "dragonwell";
firewall.enable = true;
firewall = {
enable = true;
allowedTCPPorts = [80 443];
};
};
services = {