{ config, lib, pkgs, ... }: let inherit (lib) mkIf; cfg = config.pepe.services.bazarr; in { options.pepe.services.bazarr = with lib; { enable = mkEnableOption "Enable bazarr"; package = mkPackageOption pkgs "bazarr" { }; domain = mkOption { type = types.str; default = null; }; }; config = mkIf cfg.enable { services.bazarr = { enable = true; package = cfg.package; group = "media"; }; pepe.core.vhost.hosts.${cfg.domain} = with config.pepe.core.network; { dnsInterfaces = [ interfaceTypes.vpn ]; locations."/" = { port = 6767; allowLan = true; allow = [ interfaces.${interfaceTypes.vpn}.net ]; }; }; pepe.core.media.groupMembers = mkIf config.pepe.core.media.enable [ "bazarr" ]; }; }