NixOS/system/services/jellyfin.nix

36 lines
949 B
Nix
Raw Normal View History

2024-06-17 23:28:22 +07:00
{ config, lib, ... }:
let
cfg = config.profile.services.jellyfin;
dataDir = "/nas/mediaserver/jellyfin";
domain = "jellyfin.tigor.web.id";
2024-07-04 14:03:10 +07:00
domain-jellyseerr = "jellyseerr.tigor.web.id";
2024-06-17 23:28:22 +07:00
inherit (lib) mkIf;
username = config.profile.user.name;
in
{
config = mkIf cfg.enable {
users.users.${username}.extraGroups = [ "jellyfin" ];
users.users.jellyfin.extraGroups = [ username ];
system.activationScripts.jellyfin-prepare = ''
mkdir -p ${dataDir}
chmod -R 0777 /nas/mediaserver
'';
services.caddy.virtualHosts.${domain}.extraConfig = ''
reverse_proxy 0.0.0.0:8096
'';
2024-06-26 16:34:41 +07:00
services.caddy.virtualHosts.${domain-jellyseerr} = mkIf cfg.jellyseerr.enable {
extraConfig = ''
reverse_proxy 0.0.0.0:5055
'';
};
2024-06-17 23:28:22 +07:00
services.jellyfin = {
enable = true;
inherit dataDir;
};
2024-06-26 16:34:41 +07:00
services.jellyseerr = mkIf cfg.jellyseerr.enable {
enable = true;
};
2024-06-17 23:28:22 +07:00
};
}