{ inputs, outputs, lib, config, pkgs, ... }: let inherit (lib) types mkOption mkEnableOption mkIf; cfg = config.horseman.containers.jellyfin; username = config.horseman.username; # BACKUP_DIR = config.horseman.containers.backupDir; DATA_DIR = "/home/${username}/backups/volumes/jellyfin"; in { options = { horseman.containers.jellyfin = { enable = mkEnableOption "Watch content from 'the high seas'"; port = mkOption { default = 8096; type = types.int; }; url = mkOption { default = "https://watch.koendev.nl"; type = types.str; }; }; }; config = mkIf cfg.enable { systemd.timers."backup-jellyfin" = { wantedBy = ["timers.target"]; timerConfig = { OnCalendar = "daily"; Persistent = true; }; }; # environment.systemPackages = [pkgs.gnutar]; # systemd.services."backup-jellyfin" = { # script = '' # cd ${BACKUP_DIR} # ${pkgs.gnutar}/bin/tar -cf jellyfin-$(date +'%Y-%m-%d').tar ${DATA_DIR} # ''; # serviceConfig = { # User = "root"; # }; # }; containers.jellyfin = { autoStart = true; privateNetwork = true; hostAddress = "192.168.100.5"; localAddress = "192.168.100.105"; bindMounts = { "/var/lib/media" = { hostPath = DATA_DIR; isReadOnly = false; }; }; config = { config, pkgs, ... }: { environment.systemPackages = with pkgs; [ jellyfin jellyfin-ffmpeg jellyfin-web ]; services.jellyfin = { enable = true; }; services.prowlarr = { enable = true; openFirewall = true; }; networking = { firewall = { enable = true; allowedTCPPorts = [cfg.port]; }; useHostResolvConf = lib.mkForce false; }; system.stateVersion = "23.11"; }; }; }; }