nix-config/hosts/containers/stream/default.nix

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

108 lines
2.5 KiB
Nix
Raw Normal View History

2022-01-17 15:43:33 +01:00
{ zentralwerk, config, pkgs, ... }:
2021-09-10 22:59:40 +02:00
let
authFile = pkgs.writeText "htpasswd" "k-ot:sawCOTsl/fIUY";
2022-06-28 03:26:08 +02:00
mac = {
pub = "DE:91:C7:51:D1:C5";
serv = "C6:40:E0:21:9B:A4";
};
2021-09-10 22:59:40 +02:00
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-06-28 03:26:08 +02:00
c3d2.deployment = {
server = "server9";
autoNetSetup = false;
mounts = [];
};
microvm.mem = 2048;
microvm.interfaces = [ {
type = "tap";
id = "pub-stream";
mac = mac.pub;
} {
type = "tap";
id = "serv-stream";
mac = mac.serv;
} ];
microvm.shares = map (name: {
source = "/tank/storage/stream/${name}";
mountPoint = "/${name}";
tag = name;
proto = "virtiofs";
socket = "${name}.socket";
}) [ "etc" "home" "var" ];
2021-09-10 22:59:40 +02:00
systemd.network = {
enable = true;
2022-06-28 03:26:08 +02:00
links."00-serv" = {
matchConfig.MACAddress = mac.serv;
linkConfig.Name = "serv";
};
2021-09-10 22:59:40 +02:00
networks."00-serv" = {
2022-06-28 03:26:08 +02:00
matchConfig.MACAddress = mac.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
} ];
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:26:08 +02:00
links."00-pub" = {
matchConfig.MACAddress = mac.pub;
linkConfig.Name = "pub";
};
2021-09-10 22:59:40 +02:00
networks."01-pub" = {
2022-06-28 03:26:08 +02:00
matchConfig.MACAddress = mac.pub;
2021-09-10 22:59:40 +02:00
networkConfig.DHCP = "ipv4";
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
}