Files
nix/modules/services/invidious.nix
T

102 lines
3.1 KiB
Nix

{ 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 = {
# Same as configured on invidious above.
SERVER_SECRET_KEY = companionKey;
};
};
};
};
/*virtualisation.podman.enable = true;
virtualisation.oci-containers.backend = lib.mkDefault "podman";
virtualisation.oci-containers.containers.invidious-companion = {
image = "quay.io/invidious/invidious-companion:master-5652eda";
extraOptions = [ "--network=host" "--pull=always" ];
environment = {
SERVER_SECRET_KEY = companionKey;
HOST = "127.0.0.1";
PORT = toString companionPort;
SERVER_BASE_URL = "http://127.0.0.1:${toString companionPort}";
# HTTP_PROXY = "http://proxy.example:3128";
# HTTPS_PROXY = "http://proxy.example:3128";
# NO_PROXY = "127.0.0.1,localhost";
CACHE_DIRECTORY = "/var/tmp";
NETWORKING_VIDEOPLAYBACK_UMP = "false";
NETWORKING_FETCH_RETRY_ENABLED = "true";
NETWORKING_FETCH_RETRY_TIMES = "3";
NETWORKING_FETCH_RETRY_INITIAL_DEBOUNCE = "500"; # ms
NETWORKING_FETCH_RETRY_DEBOUNCE_MULTIPLIER = "2";
#JOBS_YOUTUBE_SESSION_PO_TOKEN_ENABLED = "false";
#YOUTUBE_SESSION_OAUTH_ENABLED = "true";
};
};*/
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; # public URLs go through cloudflared on https, not :3030
invidious_companion = [
{
private_url = "http://localhost:8282/companion";
}
];
invidious_companion_key = companionKey;
continue = true;
local = true; # googlevideo URLs are bound to box's IP; proxy playback via companion
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;
};
};
/*systemd.services.invidious = let dep = "podman-invidious-companion.service"; in {
wants = [ dep ];
after = [ dep ];
requires = [ dep ];
};*/
};
};
}