Personal-use NixOS configuration
1{
2 lib,
3 python3,
4 fetchPypi,
5 fetchurl,
6 browserforge,
7 camoufox-browser,
8}:
9
10let
11 geoliteVersion = "2026.03.04";
12
13 geoliteDatabase = fetchurl {
14 url = "https://github.com/P3TERX/GeoLite.mmdb/releases/download/${geoliteVersion}/GeoLite2-City.mmdb";
15 hash = "sha256-PfkOiZ2iyg3Ux/rhFtHNZYYmGii2OJSmPHlZLp8ow20=";
16 };
17in
18python3.pkgs.buildPythonPackage rec {
19 pname = "camoufox";
20 version = "0.4.11";
21 pyproject = true;
22
23 src = fetchPypi {
24 pname = "camoufox";
25 inherit version;
26 hash = "sha256-CiydJKxQcMEE58KxJcCjk39w76QWCE74iv6Uwypy7r4=";
27 };
28
29 build-system = with python3.pkgs; [
30 setuptools
31 poetry-core
32 ];
33
34 dependencies = with python3.pkgs; [
35 browserforge
36 click
37 language-tags
38 lxml
39 numpy
40 orjson
41 platformdirs
42 playwright
43 pysocks
44 pyyaml
45 screeninfo
46 tqdm
47 ua-parser
48 requests
49 geoip2
50 ];
51
52 patches = [
53 ./use_local_browser.patch
54 ];
55
56 patchFlags = [
57 "-p2"
58 ];
59
60 postInstall = ''
61 ln -s ${camoufox-browser}/lib/camoufox-bin-* $out/${python3.sitePackages}/camoufox/camoufox-bin
62
63 cp ${geoliteDatabase} $out/${python3.sitePackages}/camoufox/GeoLite2-City.mmdb
64 '';
65
66 pythonImportsCheck = [ "camoufox" ];
67
68 meta = {
69 description = "Stealthy, minimalistic, custom build of Firefox for web scraping";
70 homepage = "https://github.com/daijro/camoufox";
71 license = lib.licenses.mpl20;
72 maintainers = with lib.maintainers; [ encode42 ];
73 };
74}