{ lib, ... }: {
  den.aspects.services.invidious = let port = 3030; in {
    tunnel = { subdomain = "tube"; inherit port; };

    nixos = { pkgs, host, ... }: let
      companionPort = 8282;
      companionPath = "/companion";
      companionKey  = "kKg3RKeZjE7frmvr";
    in {
      virtualisation.oci-containers = {
        backend = "podman";
        containers = {
          invidious-companion = {
            image = "quay.io/invidious/invidious-companion:latest";
            ports = [ "127.0.0.1:8282:8282" ];
            volumes = [
              "companioncache:/var/tmp/youtubei.js:rw"
            ];
            environment = {
              SERVER_SECRET_KEY = companionKey;
            };
          };
        };
      };

      services.invidious = {
        enable = true;
        package = pkgs.invidious;

        address = "127.0.0.1";
        port = port;

        nginx.enable = false;
        sig-helper.enable = false;

        http3-ytproxy.enable = true;

        settings = {
          domain = "tube.${host.domain}";
          #https_only = false;
          external_port = 443;

          invidious_companion = [
            {
              private_url = "http://localhost:8282/companion";
            }
          ];

          invidious_companion_key = companionKey;

          continue = true;
          local = true;
          check_tables = true;
          https_only = true;
          use_quic = false;
          admins = [ host.owner ];
          use_pubsub_feeds = false;
          captcha_enabled = false;
          login_enabled = true;
          registration_enabled = true;
          statistics_enabled = true;
        };
      };
    };
  };
}
