nixos-config/modules/invidious.nix

54 lines
1.3 KiB
Nix
Raw Normal View History

2022-08-01 15:26:50 +02:00
{ config, pkgs, lib, ... }:
let
iv_port = "3001";
domain = "yt.mc-fucker.cool";
in
2021-11-17 17:05:26 +01:00
{
services.invidious = {
2022-01-27 17:16:08 +01:00
#package = pkgs.callPackage /root/invidious {
# lsquic = pkgs.callPackage /root/invidious/lsquic.nix {};
#};
2021-11-17 17:05:26 +01:00
enable = true;
2022-08-01 15:26:50 +02:00
port = (lib.strings.toInt iv_port);
2021-11-17 17:05:26 +01:00
database = {
createLocally = false;
host = "postgres";
passwordFile = "/etc/nixos/keys/invidious-dbpassword";
};
2021-12-08 10:57:56 +01:00
settings = {
admins = [ "mc-fucker" ];
2022-01-27 17:16:08 +01:00
popular_enabled = false;
default_user_preferences = {
feed_menu = [ "Trending" "Subscriptions" "Playlists" ];
};
2021-12-08 10:57:56 +01:00
};
2021-11-17 17:05:26 +01:00
};
networking.firewall.allowedTCPPorts = [ config.services.invidious.port ];
systemd.services.invidious.serviceConfig = {
Restart = "always";
RestartSec = "2s";
};
2022-08-01 15:26:50 +02:00
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 "";
'';
};
};
};
2021-11-17 17:05:26 +01:00
}
# vim: set et ts=2 sw=2 ai: