services: add indexers

Includes both Jackett and NZBHydra2.
This commit is contained in:
Bruno BELANYI 2021-02-03 22:07:11 +01:00
parent 4d68a706a3
commit e29adcda03
3 changed files with 50 additions and 0 deletions

View file

@ -86,6 +86,11 @@
my.services = { my.services = {
# Gitea forge # Gitea forge
gitea.enable = true; gitea.enable = true;
# Meta-indexers
indexers = {
jackett.enable = true;
nzbhydra.enable = true;
};
# Jellyfin media server # Jellyfin media server
jellyfin.enable = true; jellyfin.enable = true;
# Matrix backend and Element chat front-end # Matrix backend and Element chat front-end

View file

@ -3,6 +3,7 @@
{ {
imports = [ imports = [
./gitea.nix ./gitea.nix
./indexers.nix
./jellyfin.nix ./jellyfin.nix
./matrix.nix ./matrix.nix
./media.nix ./media.nix

44
services/indexers.nix Normal file
View file

@ -0,0 +1,44 @@
# Torrent and usenet meta-indexers
{ config, lib, ... }:
let
cfg = config.my.services.indexers;
domain = config.networking.domain;
jackettDomain = "jackett.${config.networking.domain}";
nzbhydraDomain = "nzbhydra.${config.networking.domain}";
jackettPort = 9117;
nzbhydraPort = 5076;
in
{
options.my.services.indexers = with lib; {
jackett.enable = mkEnableOption "Jackett torrent meta-indexer";
nzbhydra.enable = mkEnableOption "NZBHydra2 torrent meta-indexer";
};
config = {
services.jackett = lib.mkIf cfg.jackett.enable {
enable = true;
};
services.nginx.virtualHosts."${jackettDomain}" =
lib.mkIf cfg.jackett.enable {
forceSSL = true;
useACMEHost = "${domain}";
locations."/".proxyPass = "http://localhost:${toString jackettPort}/";
};
services.nzbhydra2 = lib.mkIf cfg.nzbhydra.enable {
enable = true;
};
services.nginx.virtualHosts."${nzbhydraDomain}" =
lib.mkIf cfg.nzbhydra.enable {
forceSSL = true;
useACMEHost = "${domain}";
locations."/".proxyPass = "http://localhost:${toString nzbhydraPort}/";
};
};
}