1{
2 config,
3 lib,
4 ...
5}: let
6 name = "jellyseerr";
7 cfg = config.myNixOS.services.${name};
8
9 network = config.mySnippets.tailnet;
10 service = network.networkMap.${name};
11in {
12 options.myNixOS.services.${name} = {
13 enable = lib.mkEnableOption "${name} server";
14 autoProxy = lib.mkOption {
15 default = true;
16 example = false;
17 description = "${name} auto proxy";
18 type = lib.types.bool;
19 };
20 };
21
22 config = lib.mkIf cfg.enable {
23 services = {
24 caddy.virtualHosts."${service.vHost}".extraConfig = lib.mkIf cfg.autoProxy ''
25 bind tailscale/${name}
26 encode zstd gzip
27 reverse_proxy ${service.hostName}:${toString service.port}
28 '';
29
30 jellyseerr = {
31 enable = true;
32 inherit (service) port;
33 openFirewall = true;
34 };
35 };
36 };
37}