2022-05-21 21:59:14 +02:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
let
|
|
|
|
proxy = path: {
|
2022-05-23 21:53:50 +02:00
|
|
|
http2 = true;
|
2022-05-21 21:59:14 +02:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = path;
|
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
bigProxy = path: {
|
2022-05-23 21:53:50 +02:00
|
|
|
http2 = true;
|
2022-05-21 21:59:14 +02:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
|
|
|
locations."/" = {
|
|
|
|
proxyPass = path;
|
|
|
|
proxyWebsockets = true;
|
|
|
|
extraConfig = ''
|
|
|
|
client_max_body_size 0;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2022-05-23 12:00:41 +02:00
|
|
|
|
2022-05-23 21:57:54 +02:00
|
|
|
k8sProxy = proxy "http://kubernetes.lxd:8080/";
|
2022-05-21 21:59:14 +02:00
|
|
|
in {
|
2022-05-19 17:47:41 +02:00
|
|
|
imports = [ ../../common ../../common/lxc.nix ];
|
|
|
|
networking.hostName = "nginx";
|
|
|
|
system.stateVersion = "21.11";
|
|
|
|
networking.firewall.enable = true;
|
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
recommendedOptimisation = true;
|
|
|
|
recommendedProxySettings = true;
|
|
|
|
recommendedTlsSettings = true;
|
2022-05-23 21:53:50 +02:00
|
|
|
recommendedGzipSettings = true;
|
2022-05-19 17:47:41 +02:00
|
|
|
package = pkgs.nginxMainline;
|
2022-05-23 21:46:53 +02:00
|
|
|
|
2022-05-19 17:47:41 +02:00
|
|
|
virtualHosts."asraphiel.dev" = {
|
|
|
|
forceSSL = true;
|
2022-05-23 21:53:50 +02:00
|
|
|
http2 = true;
|
2022-05-19 17:47:41 +02:00
|
|
|
enableACME = true;
|
|
|
|
root = "/etc/main";
|
|
|
|
};
|
2022-05-21 21:59:14 +02:00
|
|
|
virtualHosts."git.asraphiel.dev" = proxy "http://gitea.lxd:3000/";
|
|
|
|
virtualHosts."vault.asraphiel.dev" = proxy "http://vault.lxd:8200/";
|
|
|
|
virtualHosts."s3.asraphiel.dev" = bigProxy "http://minio.lxd:9000/";
|
|
|
|
virtualHosts."shell.s3.asraphiel.dev" = proxy "http://minio.lxd:9001/";
|
2022-05-22 01:12:03 +02:00
|
|
|
virtualHosts."registry.asraphiel.dev" = proxy "http://registry.lxd:5000/";
|
2022-05-23 21:46:53 +02:00
|
|
|
virtualHosts."vaultwarden.asraphiel.dev" =
|
|
|
|
proxy "http://vaultwarden.lxd:8000/";
|
2022-05-23 12:00:41 +02:00
|
|
|
virtualHosts."whoami.asraphiel.dev" = k8sProxy;
|
2022-05-23 13:43:58 +02:00
|
|
|
virtualHosts."auth.asraphiel.dev" = k8sProxy;
|
2022-05-23 23:27:50 +02:00
|
|
|
virtualHosts."drone.asraphiel.dev" = k8sProxy;
|
2022-05-24 09:38:44 +02:00
|
|
|
virtualHosts."galerie.asraphiel.dev" = k8sProxy;
|
|
|
|
virtualHosts."galerie-staging.asraphiel.dev" = k8sProxy;
|
2022-05-19 17:47:41 +02:00
|
|
|
};
|
2022-05-23 21:46:53 +02:00
|
|
|
|
2022-05-19 17:47:41 +02:00
|
|
|
security.acme.email = "acme@voidcorp.nl";
|
|
|
|
security.acme.acceptTerms = true;
|
|
|
|
environment.etc."main/index.html" = {
|
|
|
|
enable = true;
|
|
|
|
source = ./index.html;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|