snowfield/modules/transmission/default.nix
2021-12-22 12:27:58 +01:00

49 lines
1 KiB
Nix

{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.luj.transmission;
port = 9091;
in {
options.luj.transmission = {
enable = mkEnableOption "activate transmission service";
nginx.enable = mkEnableOption "activate nginx";
nginx.subdomain = mkOption {
type = types.str;
};
};
config = mkIf cfg.enable (
mkMerge [{
services.transmission = {
enable = true;
group = "tv";
downloadDirPermissions = "774";
settings = {
rpc-port = 9091;
download-dir = "/home/transmission/Downloads/";
incomplete-dir = "/home/transmission/Incomplete/";
incomplete-dir-enable = true;
};
};
users.groups.tv = { name = "tv"; };
}
(mkIf cfg.nginx.enable {
luj.nginx.enable = true;
services.nginx.virtualHosts."${cfg.nginx.subdomain}.julienmalka.me" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:${toString port}";
};
};
})
]);
}