Personal-use NixOS configuration
1{
2 pkgs,
3 python3,
4 stdenv,
5 lib,
6 fetchFromGitHub,
7 makeWrapper,
8 camoufox,
9 playwright-captcha,
10}:
11
12let
13 fastapi = pkgs.callPackage ./fastapi.nix { };
14
15 pythonDependencies = with python3.pkgs; [
16 camoufox
17 fastapi
18 playwright
19 playwright-captcha
20 pydantic
21 uvicorn
22 ];
23
24 pythonInterpreter = python3.withPackages (_: pythonDependencies);
25in
26stdenv.mkDerivation rec {
27 pname = "byparr";
28 version = "2.1.0";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "ThePhaseless";
33 repo = "Byparr";
34 tag = "v${version}";
35 hash = "sha256-6XlhQJI/TBYXbojivBp+dFXJDcuBsY6ZLwLwTw+YqMA=";
36 };
37
38 build-system = with python3.pkgs; [
39 setuptools
40 ];
41
42 nativeBuildInputs = [
43 makeWrapper
44 ];
45
46 dependencies = pythonDependencies;
47
48 installPhase = ''
49 runHook preInstall
50
51 mkdir -p $out/share/${pname}
52
53 cp -r ${src}/main.py ${src}/src $out/share/${pname}/
54
55 makeWrapper ${pythonInterpreter}/bin/python $out/bin/${pname} \
56 --add-flags "$out/share/${pname}/main.py"
57
58 runHook postInstall
59 '';
60
61 meta = {
62 description = "Provides http cookies and headers for websites protected with anti-bot protections";
63 homepage = "https://github.com/ThePhaseless/Byparr";
64 license = lib.licenses.gpl3Only;
65 maintainers = with lib.maintainers; [ encode42 ];
66 mainProgram = "byparr";
67 };
68}