Refactored modules

This commit is contained in:
Julien Malka 2021-12-04 13:13:13 +01:00
parent 56c0af44ca
commit f4f5d6e869
16 changed files with 368 additions and 24 deletions

View file

@ -0,0 +1,43 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.luj.sonarr;
port = 8989;
in {
options.luj.sonarr = {
enable = mkEnableOption "activate sonarr service";
nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption {
type = types.str;
};
};
config = mkIf cfg.enable (
mkMerge [{
services.sonarr = {
enable = true;
#user = "transmission";
#group = "transmission";
#dataDir = "/var/lib/sonarr/.config/NzbDrone";
group = "tv";
};
networking.firewall = { allowedTCPPorts = [ port ]; };
}
(mkIf cfg.nginx.enable {
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:${toString port}";
};
};
})
]);
}