Additional plexy work

This commit is contained in:
kat witch 2022-04-07 18:30:27 +01:00 committed by kat
parent 5c72cf5d95
commit f6ccfb9e58
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
5 changed files with 77 additions and 17 deletions

View file

@ -1,7 +1,7 @@
{ config, lib, meta, ... }: with lib; {
deploy.tf.dns.records.services_media_forward = {
deploy.tf.dns.records.services_plex = {
inherit (config.network.dns) zone;
domain = "media";
domain = "plex";
cname = { inherit (config.network.addresses.public) target; };
};
@ -23,24 +23,37 @@
forceSSL = true;
enableACME = true;
locations = {
"/".proxyPass = "http://cloud.int.kittywit.ch:80/";
"/".proxyPass = "http://cloud.int.kittywit.ch/";
};
};
"media.${config.network.dns.domain}" = {
"plex.${config.network.dns.domain}" = {
forceSSL = true;
enableACME = true;
locations = {
"/jellyfin/".proxyPass = "http://[${meta.network.nodes.yukari.network.addresses.yggdrasil.nixos.ipv6.address}]:8096/jellyfin/";
"/jellyfin/socket" = {
proxyPass = "http://[${meta.network.nodes.yukari.network.addresses.yggdrasil.nixos.ipv6.address}]:8096/jellyfin/";
extraConfig = ''
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
'';
"/" = {
proxyPass = "http://[${meta.network.nodes.yukari.network.addresses.yggdrasil.nixos.ipv6.address}]";
extraConfig = ''
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_buffering off;
proxy_set_header X-Plex-Client-Identifier $http_x_plex_client_identifier;
proxy_set_header X-Plex-Device $http_x_plex_device;
proxy_set_header X-Plex-Device-Name $http_x_plex_device_name;
proxy_set_header X-Plex-Platform $http_x_plex_platform;
proxy_set_header X-Plex-Platform-Version $http_x_plex_platform_version;
proxy_set_header X-Plex-Product $http_x_plex_product;
proxy_set_header X-Plex-Token $http_x_plex_token;
proxy_set_header X-Plex-Version $http_x_plex_version;
proxy_set_header X-Plex-Nocache $http_x_plex_nocache;
proxy_set_header X-Plex-Provides $http_x_plex_provides;
proxy_set_header X-Plex-Device-Vendor $http_x_plex_device_vendor;
proxy_set_header X-Plex-Model $http_x_plex_model;
'';
};
};
};
};
}
}
(mkIf config.deploy.profile.trusted (import config.kw.secrets.repo.access.source { inherit config meta; }))
];
}

View file

@ -3,7 +3,7 @@
deploy.tf.dns.records.services_home = {
inherit (config.network.dns) zone;
domain = "home";
cname = { inherit (config.network.addresses.public) target; };
a = { inherit (config.network.addresses.public.tf.ipv4) address; };
};
services.nginx.virtualHosts = {
@ -12,7 +12,7 @@
enableACME = true;
locations = {
"/" = {
proxyPass = "http://home.int.kittywit.ch:80/";
proxyPass = "http://home.int.kittywit.ch:8123";
extraConfig = ''
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

View file

@ -1,7 +1,41 @@
{ config, ... }: {
{ config, kw, pkgs, lib, ... }: {
services = {
plex = {
enable = true;
package = pkgs.plex.overrideAttrs (x: let
# see https://www.plex.tv/media-server-downloads/ for 64bit rpm
version = "1.25.9.5721-965587f64";
sha256 = "sha256-NPfpQ8JwXDaq8xpvSabyqdDqMWjoqbeoJdu41nhdsI0=";
in {
name = "plex-${version}";
src = pkgs.fetchurl {
url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb";
inherit sha256;
};
}
);
};
nginx.virtualHosts."plex.kittywit.ch".locations."/" = {
proxyPass = "http://127.0.0.1:32400";
extraConfig = ''
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_buffering off;
proxy_set_header X-Plex-Client-Identifier $http_x_plex_client_identifier;
proxy_set_header X-Plex-Device $http_x_plex_device;
proxy_set_header X-Plex-Device-Name $http_x_plex_device_name;
proxy_set_header X-Plex-Platform $http_x_plex_platform;
proxy_set_header X-Plex-Platform-Version $http_x_plex_platform_version;
proxy_set_header X-Plex-Product $http_x_plex_product;
proxy_set_header X-Plex-Token $http_x_plex_token;
proxy_set_header X-Plex-Version $http_x_plex_version;
proxy_set_header X-Plex-Nocache $http_x_plex_nocache;
proxy_set_header X-Plex-Provides $http_x_plex_provides;
proxy_set_header X-Plex-Device-Vendor $http_x_plex_device_vendor;
proxy_set_header X-Plex-Model $http_x_plex_model;
'';
};
};
}

View file

@ -21,6 +21,19 @@
};
};
systemd.services.antennas = {
wantedBy = [ "plex.service" ];
after = [ "tvheadend-kat.service" ];
serviceConfig = let
antennaConf = pkgs.writeText "config.yaml" (builtins.toJSON {
antennas_url = "http://127.0.0.1:5009";
tvheadend_url = "http://127.0.0.1:9981";
tuner_count = "6";
}); in {
ExecStart = "${pkgs.antennas}/bin/antennas --config ${antennaConf}";
};
};
systemd.services.tvheadend-kat = {
description = "Tvheadend TV streaming server";
wantedBy = [ "multi-user.target" ];

@ -1 +1 @@
Subproject commit 736c050ee87fd11137f75112c0548174ec654036
Subproject commit a008ca692a8217c4f52ceac1d40be39f77c9a324