nixos-config/modules/invidious.nix
2022-08-01 15:26:50 +02:00

53 lines
1.3 KiB
Nix

{ config, pkgs, lib, ... }:
let
iv_port = "3001";
domain = "yt.mc-fucker.cool";
in
{
services.invidious = {
#package = pkgs.callPackage /root/invidious {
# lsquic = pkgs.callPackage /root/invidious/lsquic.nix {};
#};
enable = true;
port = (lib.strings.toInt iv_port);
database = {
createLocally = false;
host = "postgres";
passwordFile = "/etc/nixos/keys/invidious-dbpassword";
};
settings = {
admins = [ "mc-fucker" ];
popular_enabled = false;
default_user_preferences = {
feed_menu = [ "Trending" "Subscriptions" "Playlists" ];
};
};
};
networking.firewall.allowedTCPPorts = [ config.services.invidious.port ];
systemd.services.invidious.serviceConfig = {
Restart = "always";
RestartSec = "2s";
};
services.nginx.virtualHosts."${domain}" = {
forceSSL = true;
enableACME = true;
locations = {
"/" = {
proxyPass = "http://127.0.0.1:${iv_port}";
extraConfig = ''
set $empty "";
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
};
};
};
}
# vim: set et ts=2 sw=2 ai: