nix-config/hosts/stream/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

83 lines
2.1 KiB
Nix
Raw Normal View History

2022-11-26 00:37:22 +01:00
{ zentralwerk, config, lib, pkgs, ... }:
2021-09-10 22:59:40 +02:00
let
authFile = pkgs.writeText "htpasswd" "k-ot:sawCOTsl/fIUY";
in
{
2021-09-10 23:02:57 +02:00
networking.hostName = "stream";
2021-09-10 22:59:40 +02:00
c3d2.hq.statistics.enable = true;
2022-11-26 00:37:22 +01:00
deployment = {
persistedShares = [ "/etc" "/home" "/var" ];
storage = "big";
mem = 4096;
2022-11-26 00:37:22 +01:00
networks = lib.mkForce [ "pub" "serv" ];
2022-06-28 03:26:08 +02:00
};
2021-09-10 22:59:40 +02:00
systemd.network = {
enable = true;
2022-06-28 03:30:58 +02:00
# On the serv network I have a static IPv4 and only a route to the
# rest of the network so that I am reachable by
# public-access-proxy.
2022-11-26 00:37:22 +01:00
networks."30-serv" = {
2021-09-10 22:59:40 +02:00
networkConfig.IPv6AcceptRA = false;
2022-06-28 03:26:08 +02:00
# try harder disabling global ipv6
networkConfig.LinkLocalAddressing = "no";
2021-09-10 22:59:40 +02:00
addresses = [ {
2022-01-16 13:26:37 +01:00
addressConfig.Address = "${config.c3d2.hosts.stream.ip4}/${toString zentralwerk.lib.config.site.net.serv.subnet4Len}";
2021-09-10 22:59:40 +02:00
} ];
2022-11-26 00:37:22 +01:00
gateway = lib.mkForce [];
2021-09-10 22:59:40 +02:00
routes = [ {
routeConfig = {
Destination = "172.20.0.0/14";
2022-01-16 13:26:37 +01:00
Gateway = config.c3d2.hosts.serv-gw.ip4;
2021-09-10 22:59:40 +02:00
};
} ];
};
2022-06-28 03:30:58 +02:00
# On the pub network I am a normal client.
2022-11-26 00:37:22 +01:00
networks."30-pub" = {
2021-09-10 22:59:40 +02:00
networkConfig.DHCP = "ipv4";
2022-11-27 17:23:47 +01:00
gateway = lib.mkForce [];
2022-06-28 03:26:08 +02:00
networkConfig.IPv6AcceptRA = true;
2021-09-10 22:59:40 +02:00
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.peerflix.enable = true;
systemd.services.peerflix.serviceConfig = {
Restart = "always";
RestartSec = 60;
};
2021-11-07 03:38:41 +01:00
services.jackett.enable = true;
2021-09-10 22:59:40 +02:00
services.nginx = {
enable = true;
virtualHosts."stream.hq.c3d2.de" = {
default = true;
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:9000";
extraConfig = ''
auth_basic "Stream";
auth_basic_user_file ${authFile};
'';
};
};
2021-11-07 03:38:41 +01:00
virtualHosts."torrents.hq.c3d2.de" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:9117";
extraConfig = ''
auth_basic "Torrents";
auth_basic_user_file ${authFile};
'';
};
};
2021-09-10 22:59:40 +02:00
};
2022-06-28 03:26:08 +02:00
system.stateVersion = "22.05";
2021-09-10 22:59:40 +02:00
}