Add *.home.heartles.xyz proxy

This commit is contained in:
jaina heartles 2024-02-29 13:08:22 -08:00
parent 3296b3a7cf
commit fc6cf2962e
2 changed files with 59 additions and 1 deletions

View file

@ -1,5 +1,9 @@
{ pkgs, ... }@inputs: { { pkgs, ... }@inputs: {
imports = [ ./hardware-configuration.nix ./misskey-service.nix ]; imports = [
./hardware-configuration.nix
./misskey-service.nix
./heartles-xyz-proxy.nix
];
nix.settings = { nix.settings = {
experimental-features = [ "nix-command" "flakes" ]; experimental-features = [ "nix-command" "flakes" ];

54
heartles-xyz-proxy.nix Normal file
View file

@ -0,0 +1,54 @@
{ config, lib, ... }: {
networking.firewall.allowedTCPPorts = [ 80 443 ];
security.acme = {
acceptTerms = true;
defaults.email = "admin+acme@heartles.xyz";
certs."STAR.home.heartles.xyz" = {
domain = "*.home.heartles.xyz";
dnsProvider = "namecheap";
credentialsFile = "/etc/nixos-secrets/namecheap-acme";
group = "nginx";
};
};
services.nginx = {
enable = true;
recommendedProxySettings = true;
virtualHosts = {
"*.home.heartles.xyz" = {
listen = [
{
port = 443;
addr = "0.0.0.0";
ssl = true;
}
{
port = 80;
addr = "0.0.0.0";
}
{
port = 443;
addr = "[::]";
ssl = true;
}
{
port = 80;
addr = "[::]";
}
];
useACMEHost = "STAR.home.heartles.xyz";
forceSSL = true;
locations."/" = {
proxyWebsockets = true;
extraConfig = ''
proxy_ssl_name $host;
include /etc/nixos-secrets/nginx-proxy-pass-home.conf;
'';
};
};
};
};
}