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} ## 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 - [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) for LLMs. Available as [services.open-webui](#opt-services.open-webui.enable)
service. service.

View File

@ -732,6 +732,7 @@
./services/misc/etesync-dav.nix ./services/misc/etesync-dav.nix
./services/misc/evdevremapkeys.nix ./services/misc/evdevremapkeys.nix
./services/misc/felix.nix ./services/misc/felix.nix
./services/misc/flaresolverr.nix
./services/misc/forgejo.nix ./services/misc/forgejo.nix
./services/misc/freeswitch.nix ./services/misc/freeswitch.nix
./services/misc/fstrim.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; }; firewall-nftables = handleTest ./firewall.nix { nftables = true; };
fish = handleTest ./fish.nix {}; fish = handleTest ./fish.nix {};
flannel = handleTestOn ["x86_64-linux"] ./flannel.nix {}; flannel = handleTestOn ["x86_64-linux"] ./flannel.nix {};
flaresolverr = handleTest ./flaresolverr.nix {};
flood = handleTest ./flood.nix {}; flood = handleTest ./flood.nix {};
floorp = handleTest ./firefox.nix { firefoxPackage = pkgs.floorp; }; floorp = handleTest ./firefox.nix { firefoxPackage = pkgs.floorp; };
fluentd = handleTest ./fluentd.nix {}; 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/")
'';
}
)