nixos-config/services/jellyfin.nix

47 lines
865 B
Nix
Raw Normal View History

2022-04-10 11:54:58 +02:00
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
2022-01-11 16:08:21 +01:00
mkEnableOption
mkIf
2022-04-10 11:54:58 +02:00
;
2022-01-11 16:08:21 +01:00
2021-02-19 21:21:35 +01:00
cfg = config.my.services.jellyfin;
my = config.my;
domain = config.networking.domain;
hostname = config.networking.hostName;
fqdn = "${hostname}.${domain}";
2021-02-19 21:21:35 +01:00
# hardcoded in NixOS module :(
jellyfinPort = 8096;
in {
options.my.services.jellyfin = {
enable = mkEnableOption "Jellyfin";
};
2022-01-11 16:08:21 +01:00
config = mkIf cfg.enable {
2021-02-19 21:21:35 +01:00
services.jellyfin = {
enable = true;
group = "media";
};
# Proxy to Jellyfin
services.nginx.virtualHosts."jellyfin.${domain}" = {
forceSSL = true;
useACMEHost = fqdn;
2021-02-19 21:21:35 +01:00
2021-02-22 11:58:54 +01:00
locations."/" = {
proxyPass = "http://localhost:${toString jellyfinPort}/";
proxyWebsockets = true;
};
2021-02-19 21:21:35 +01:00
};
security.acme.certs.${fqdn}.extraDomainNames = ["jellyfin.${domain}"];
2021-02-19 21:21:35 +01:00
};
}