9 cfg = config.services.flaresolverr;
13 services.flaresolverr = {
14 enable = lib.mkEnableOption "FlareSolverr, a proxy server to bypass Cloudflare protection";
16 package = lib.mkPackageOption pkgs "flaresolverr" { };
18 openFirewall = lib.mkOption {
19 type = lib.types.bool;
21 description = "Open the port in the firewall for FlareSolverr.";
25 type = lib.types.port;
27 description = "The port on which FlareSolverr will listen for incoming HTTP traffic.";
32 config = lib.mkIf cfg.enable {
33 systemd.services.flaresolverr = {
34 description = "FlareSolverr";
35 after = [ "network.target" ];
36 wantedBy = [ "multi-user.target" ];
39 HOME = "/run/flaresolverr";
40 PORT = toString cfg.port;
44 SyslogIdentifier = "flaresolverr";
49 RuntimeDirectory = "flaresolverr";
50 WorkingDirectory = "/run/flaresolverr";
51 ExecStart = lib.getExe cfg.package;
56 networking.firewall = lib.mkIf cfg.openFirewall { allowedTCPPorts = [ cfg.port ]; };