1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

nixos/flaresolverr: initial commit

This commit is contained in:
Pavel Sobolev 2024-07-05 23:06:17 +03:00
parent ebbc040968
commit c9c14f86db
No known key found for this signature in database
5 changed files with 84 additions and 0 deletions

View file

@ -18,6 +18,8 @@
## New Services {#sec-release-24.11-new-services}
- [FlareSolverr](https://github.com/FlareSolverr/FlareSolverr), proxy server to bypass Cloudflare protection. Available as [services.flaresolverr](#opt-services.flaresolverr.enable) service.
- [Open-WebUI](https://github.com/open-webui/open-webui), a user-friendly WebUI
for LLMs. Available as [services.open-webui](#opt-services.open-webui.enable)
service.

View file

@ -732,6 +732,7 @@
./services/misc/etesync-dav.nix
./services/misc/evdevremapkeys.nix
./services/misc/felix.nix
./services/misc/flaresolverr.nix
./services/misc/forgejo.nix
./services/misc/freeswitch.nix
./services/misc/fstrim.nix

View file

@ -0,0 +1,58 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.services.flaresolverr;
in
{
options = {
services.flaresolverr = {
enable = lib.mkEnableOption "FlareSolverr, a proxy server to bypass Cloudflare protection";
package = lib.mkPackageOption pkgs "flaresolverr" { };
openFirewall = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Open the port in the firewall for FlareSolverr.";
};
port = lib.mkOption {
type = lib.types.port;
default = 8191;
description = "The port on which FlareSolverr will listen for incoming HTTP traffic.";
};
};
};
config = lib.mkIf cfg.enable {
systemd.services.flaresolverr = {
description = "FlareSolverr";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
environment = {
HOME = "/run/flaresolverr";
PORT = toString cfg.port;
};
serviceConfig = {
SyslogIdentifier = "flaresolverr";
Restart = "always";
RestartSec = 5;
Type = "simple";
DynamicUser = true;
RuntimeDirectory = "flaresolverr";
WorkingDirectory = "/run/flaresolverr";
ExecStart = lib.getExe cfg.package;
TimeoutStopSec = 30;
};
};
networking.firewall = lib.mkIf cfg.openFirewall { allowedTCPPorts = [ cfg.port ]; };
};
}

View file

@ -332,6 +332,7 @@ in {
firewall-nftables = handleTest ./firewall.nix { nftables = true; };
fish = handleTest ./fish.nix {};
flannel = handleTestOn ["x86_64-linux"] ./flannel.nix {};
flaresolverr = handleTest ./flaresolverr.nix {};
flood = handleTest ./flood.nix {};
floorp = handleTest ./firefox.nix { firefoxPackage = pkgs.floorp; };
fluentd = handleTest ./fluentd.nix {};

View file

@ -0,0 +1,22 @@
import ./make-test-python.nix (
{ lib, ... }:
{
name = "flaresolverr";
meta.maintainers = with lib.maintainers; [ paveloom ];
nodes.machine =
{ pkgs, ... }:
{
services.flaresolverr = {
enable = true;
port = 8888;
};
};
testScript = ''
machine.wait_for_unit("flaresolverr.service")
machine.wait_for_open_port(8888)
machine.succeed("curl --fail http://localhost:8888/")
'';
}
)