2021-07-13 09:53:22 +01:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
2022-04-05 13:05:08 +01:00
|
|
|
let
|
2022-02-15 10:58:08 +00:00
|
|
|
network = import ./network.nix;
|
2022-04-05 13:05:08 +01:00
|
|
|
domain = "media.giugl.io";
|
2022-02-15 10:58:08 +00:00
|
|
|
in {
|
2021-11-25 11:42:32 +00:00
|
|
|
disabledModules = [ "services/misc/jellyfin.nix" ];
|
|
|
|
imports = [ ./modules/jellyfin.nix ];
|
|
|
|
|
2021-07-07 13:13:19 +01:00
|
|
|
services = {
|
2021-10-11 10:31:21 +01:00
|
|
|
jellyfin = {
|
2021-11-25 11:42:32 +00:00
|
|
|
enable = true;
|
2022-03-15 15:58:04 +00:00
|
|
|
group = "media";
|
2021-11-25 11:42:32 +00:00
|
|
|
package = pkgs.unstable.jellyfin;
|
2021-10-11 10:31:21 +01:00
|
|
|
};
|
2021-07-07 13:13:19 +01:00
|
|
|
|
2022-02-15 10:58:08 +00:00
|
|
|
nginx.virtualHosts.${domain} = {
|
2022-04-05 13:05:08 +01:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
2022-04-05 16:07:56 +01:00
|
|
|
extraConfig = ''
|
|
|
|
# External Javascript (such as cast_sender.js for Chromecast) must be whitelisted.
|
2022-07-06 19:34:12 +01:00
|
|
|
#add_header Content-Security-Policy "default-src https: data: blob: http://image.tmdb.org; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' https://www.gstatic.com/cv/js/sender/v1/cast_sender.js https://www.gstatic.com/eureka/clank/95/cast_sender.js https://www.gstatic.com/eureka/clank/96/cast_sender.js https://www.gstatic.com/eureka/clank/97/cast_sender.js https://www.youtube.com blob:; worker-src 'self' blob:; connect-src 'self'; object-src 'none'; frame-ancestors 'self'";
|
2022-04-05 16:07:56 +01:00
|
|
|
# Disable buffering when the nginx proxy gets very resource heavy upon streaming
|
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
|
2021-07-07 13:13:19 +01:00
|
|
|
locations."/" = {
|
2022-11-10 23:32:54 +00:00
|
|
|
proxyPass = "http://127.0.0.1:8096";
|
2022-10-09 22:24:27 +01:00
|
|
|
# extraConfig = ''
|
|
|
|
# allow 10.0.0.0/24;
|
|
|
|
# allow 10.3.0.0/24;
|
|
|
|
# deny all;
|
|
|
|
# '';
|
2022-04-05 13:05:08 +01:00
|
|
|
};
|
2022-04-05 16:07:56 +01:00
|
|
|
|
2022-04-05 13:05:08 +01:00
|
|
|
locations."/socket" = {
|
2022-11-10 23:32:54 +00:00
|
|
|
proxyPass = "http://127.0.0.1:8096";
|
2022-04-05 13:05:08 +01:00
|
|
|
proxyWebsockets = true;
|
2022-10-09 22:24:27 +01:00
|
|
|
# extraConfig = ''
|
|
|
|
# allow 10.0.0.0/24;
|
|
|
|
# allow 10.3.0.0/24;
|
|
|
|
# deny all;
|
|
|
|
# '';
|
2021-07-07 13:13:19 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
networking.extraHosts = ''
|
2022-02-15 10:58:08 +00:00
|
|
|
${network.architect-lan} ${domain}
|
|
|
|
${network.architect-wg} ${domain}
|
2021-07-07 13:13:19 +01:00
|
|
|
'';
|
|
|
|
|
2021-11-25 11:42:32 +00:00
|
|
|
users.groups.media.members = [ "jellyfin" ];
|
|
|
|
users.groups.video.members = [ "jellyfin" ];
|
|
|
|
users.groups.render.members = [ "jellyfin" ];
|
2022-03-15 15:58:04 +00:00
|
|
|
|
|
|
|
fileSystems."/tmp/jellyfin" = {
|
|
|
|
device = "none";
|
|
|
|
fsType = "tmpfs";
|
|
|
|
options = [ "defaults" "size=20G" "uid=jellyfin" ];
|
|
|
|
};
|
2021-07-07 13:13:19 +01:00
|
|
|
}
|