about summary refs log tree commit diff
path: root/modules/services/invidious.nix
blob: 8952cda1a63062f65bdd4e44a9ff72d94ecea4bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ 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;
      sig-helper.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" ];
      };
    };
  };
}