2024-01-06 01:19:35 +01:00
|
|
|
# SPDX-FileCopyrightText: 2021-2023 Simon Bruder <simon@sbruder.de>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
|
2023-05-06 10:54:03 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2021-09-08 18:23:21 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
sops.secrets.invidious-extra-settings = {
|
|
|
|
sopsFile = ../../secrets.yaml;
|
|
|
|
group = "keys"; # not ideal, but required since the invidious user is dynamic
|
|
|
|
mode = "440";
|
|
|
|
};
|
|
|
|
systemd.services.invidious.serviceConfig.SupplementaryGroups = [ "keys" ];
|
|
|
|
|
|
|
|
services.invidious = {
|
|
|
|
enable = true;
|
2022-04-02 10:53:39 +02:00
|
|
|
package = pkgs.unstable.invidious.overrideAttrs (o: o // {
|
2021-09-08 18:23:21 +02:00
|
|
|
patches = (o.patches or [ ]) ++ [
|
|
|
|
./0001-Prefer-opus-audio-streams-in-listen-mode.patch
|
|
|
|
];
|
|
|
|
});
|
|
|
|
nginx.enable = true;
|
|
|
|
domain = "iv.sbruder.xyz";
|
|
|
|
settings = {
|
|
|
|
host_binding = "127.0.0.1";
|
|
|
|
log_level = "Warn";
|
|
|
|
default_user_preferences = {
|
|
|
|
# allow higher qualities
|
|
|
|
quality = "dash";
|
|
|
|
quality_dash = "auto";
|
|
|
|
|
|
|
|
# humane volume
|
|
|
|
volume = 50;
|
|
|
|
|
|
|
|
# no “popular” content
|
|
|
|
feed_menu = [ "Subscriptions" "Playlists" ];
|
|
|
|
default_home = ""; # search on /
|
|
|
|
};
|
|
|
|
disable_proxy = [ "downloads" ]; # legal precaution
|
|
|
|
local = true; # no external requests
|
|
|
|
use_pubsub_feeds = true;
|
|
|
|
modified_source_code_url = "https://github.com/sbruder/invidious/tree/patches";
|
2023-05-06 10:54:03 +02:00
|
|
|
https_only = lib.mkForce true;
|
2021-09-08 18:23:21 +02:00
|
|
|
};
|
|
|
|
extraSettingsFile = config.sops.secrets.invidious-extra-settings.path;
|
|
|
|
};
|
|
|
|
|
2021-12-09 21:43:29 +01:00
|
|
|
systemd.services.invidious.serviceConfig = {
|
|
|
|
Restart = "on-failure";
|
|
|
|
};
|
|
|
|
|
2021-09-08 18:23:21 +02:00
|
|
|
services.nginx.virtualHosts."iv.sbruder.xyz" = {
|
2023-05-06 10:54:03 +02:00
|
|
|
enableACME = false;
|
|
|
|
forceSSL = false;
|
|
|
|
extraConfig = ''
|
|
|
|
allow ${config.sbruder.wireguard.home.subnet};
|
|
|
|
deny all;
|
|
|
|
'';
|
2021-09-08 18:23:21 +02:00
|
|
|
locations = {
|
|
|
|
"/robots.txt".return = "200 'User-agent: *\\nDisallow: /'";
|
|
|
|
"/privacy".return = "301 'https://sbruder.xyz/#privacy'";
|
2023-02-24 10:07:58 +01:00
|
|
|
"/feed/popular".return = "403"; # leaks data about its users
|
2021-09-08 18:23:21 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|