{ config, lib, pkgs, ... }: with lib; let cfg = config.modules.services.invidious; in { options.modules.services.invidious = { enable = mkEnableOption "invidious instance"; domain = mkOption { type = types.str; }; realHost = mkOption { type = types.str; default = "invidious.${cfg.domain}"; }; secrets = { invidious-hmac-key = mkOption { type = types.path; description = "path to the file containing the HMAC key"; }; }; }; config = mkIf cfg.enable { services.invidious = { enable = true; port = 4003; domain = cfg.realHost; hmacKeyFile = cfg.secrets.invidious-hmac-key; database.createLocally = true; http3-ytproxy.enable = true; settings = { db.user = "indivious"; db.dbname = "indivious"; check_tables = true; external_port = 443; https_only = true; quality = "dash"; quality_dash = "best"; use_pubsub_feeds = true; popular_enabled = false; feed_menu = [ /* "Popular" */ "Trending" "Subscriptions" "Playlists" ]; default_home = "Trending"; captions = [ "English" "Japanese" "Korean" ]; }; }; }; }