{ 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; settings = { db.user = "indivious"; captions = [ "English" "Japanese" "Korean" ]; check_tables = true; }; }; }; }