1
0
Fork 0
dotfiles/system/nixos/home-proxy.nix

53 lines
1.2 KiB
Nix
Raw Normal View History

2023-04-08 22:37:43 +00:00
{ pkgs, config, secret, ... }:
{
services.nginx.streamConfig = ''
2023-04-08 22:43:37 +00:00
resolver 1.1.1.1 ipv6=off;
2023-06-07 18:40:27 +00:00
upstream video {
server ${secret.nginx.upstream.video.hostname}:${builtins.toString secret.nginx.upstream.video.upstreamPort};
2023-04-09 00:11:14 +00:00
}
2023-04-08 22:37:43 +00:00
server {
2023-06-07 18:40:27 +00:00
listen ${builtins.toString secret.nginx.upstream.video.externalPort};
2023-04-09 00:11:14 +00:00
proxy_protocol on;
2023-06-07 18:40:27 +00:00
proxy_pass video;
2023-04-08 22:37:43 +00:00
}
'';
2023-06-07 18:40:27 +00:00
services.nginx = {
commonHttpConfig = ''
resolver 1.1.1.1;
'';
upstreams.dns = {
servers = {
"${secret.nginx.upstream.dns.primary.hostname}:${builtins.toString secret.nginx.upstream.dns.primary.upstreamPort}" = { };
};
};
virtualHosts."${secret.nginx.upstream.dns.fqdn}" = {
quic = true;
http3 = true;
onlySSL = true;
useACMEHost = "cache.daniel.sx";
locations."/${secret.adguardhome.auth}/dns-query" = {
recommendedProxySettings = true;
proxyPass = "https://dns";
extraConfig = ''
rewrite ^/${secret.adguardhome.auth}(.*)$ $1 break;
proxy_hide_header alt-svc;
'';
};
};
};
networking.firewall.interfaces."enp1s0".allowedTCPPorts = [
secret.nginx.upstream.video.externalPort
];
2023-04-08 22:37:43 +00:00
}