From df1bc0d0d518e151983d562516ae6a77870a5dcc Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Fri, 15 Oct 2021 15:10:03 +0200 Subject: [PATCH] modules: services: indexers: refactor This is cleaner and more correct. --- modules/services/indexers/default.nix | 57 +++++++++++++++------------ 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/modules/services/indexers/default.nix b/modules/services/indexers/default.nix index 0d272f8..af0f482 100644 --- a/modules/services/indexers/default.nix +++ b/modules/services/indexers/default.nix @@ -12,32 +12,39 @@ in nzbhydra.enable = mkEnableOption "NZBHydra2 usenet meta-indexer"; }; - config = { - services.jackett = lib.mkIf cfg.jackett.enable { - enable = true; - }; - - # Jackett wants to eat *all* my RAM if left to its own devices - systemd.services.jackett = { - serviceConfig = { - MemoryHigh = "15%"; - MemoryMax = "25%"; + config = lib.mkMerge [ + (lib.mkIf cfg.jackett.enable { + services.jackett = { + enable = true; }; - }; - services.nzbhydra2 = lib.mkIf cfg.nzbhydra.enable { - enable = true; - }; + # Jackett wants to eat *all* my RAM if left to its own devices + systemd.services.jackett = { + serviceConfig = { + MemoryHigh = "15%"; + MemoryMax = "25%"; + }; + }; - my.services.nginx.virtualHosts = [ - { - subdomain = "jackett"; - port = jackettPort; - } - { - subdomain = "nzbhydra"; - port = nzbhydraPort; - } - ]; - }; + my.services.nginx.virtualHosts = [ + { + subdomain = "jackett"; + port = jackettPort; + } + ]; + }) + + (lib.mkIf cfg.nzbhydra.enable { + services.nzbhydra2 = { + enable = true; + }; + + my.services.nginx.virtualHosts = [ + { + subdomain = "nzbhydra"; + port = nzbhydraPort; + } + ]; + }) + ]; }