1
0
Fork 0
permafrost/modules/foundry.nix

43 lines
1.3 KiB
Nix
Raw Normal View History

2024-12-27 06:21:59 -08:00
{ lib, config, ... }:
let
cfg = config.permafrost.foundry;
2024-12-27 13:43:11 -08:00
ACMEEnabled = config.permafrost.nginx.enableACME;
2024-12-27 06:21:59 -08:00
in
{
options.permafrost.foundry = {
enable = lib.mkEnableOption "foundry nixos module";
};
config = lib.mkIf cfg.enable {
permafrost.nginx.enable = lib.mkDefault true;
2024-12-27 07:12:57 -08:00
permafrost.nginx.certDomains = lib.mkIf ACMEEnabled [ "scarlet.zynh.me" ];
2024-12-27 06:21:59 -08:00
services.nginx.virtualHosts."scarlet.zynh.me" = {
2024-12-27 07:16:10 -08:00
# TODO: Force ssl
2024-12-27 13:44:21 -08:00
# addSSL = true;
2024-12-27 06:21:59 -08:00
serverName = "scarlet.zynh.me";
2024-12-27 07:12:57 -08:00
useACMEHost = lib.mkIf ACMEEnabled "scarlet.zynh.me";
2024-12-27 06:21:59 -08:00
locations."/" = {
extraConfig = /* nginx */ ''
# Set proxy headers
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# These are important to support WebSockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
'';
proxyPass = "http://localhost:30000";
};
};
2024-12-27 06:27:00 -08:00
services.nginx.virtualHosts."ddbimporter.zynh.me" = {
2024-12-27 13:44:21 -08:00
# TODO: Force ssl
# addSSL = true;
2024-12-27 06:27:00 -08:00
serverName = "ddbimporter.zynh.me";
locations."/".proxyPass = "http://localhost:3232";
};
2024-12-27 06:21:59 -08:00
};
}