{ python3Packages, hectic }: python3Packages.buildPythonPackage {
  pname = "vpn-shop";
  version = "1.0";

  src = ./.;

  propagatedBuildInputs = with python3Packages; [
    aiogram
    aiohttp
    python-dotenv
    aiosqlite
    pydantic
    sqlalchemy
    APScheduler
    uvloop
    asyncpg
    psycopg2-binary
    cryptography
  ] ++ (with hectic; [ py3-marzban ]);

  postPatch = ''
    cat > setup.py <<'EOF'
    from setuptools import setup, find_packages
    
    setup(
        name="dreamproxy-bot",
        version="1.0",
        package_data={
            "": ['locales/**/*'],
        },
        include_package_data=True,
        packages=[
          "database",
          "filters",
          "handlers",
          "keyboards",
          "payments",
          "states",
          "utils",
          "vpns",
        ],
        py_modules=['bot'],
        install_requires=[
          "aiogram>=3.0.0",
          "aiohttp",
          "python-dotenv>=0.19.0",
          "aiosqlite>=0.17.0",
          "pydantic>=2.0.0",
          "marzban",
          "sqlalchemy",
          "APScheduler>=3.10.1",
          "uvloop",
          "asyncpg",
          "psycopg2-binary",
          "cryptography",
        ],
        entry_points={
          "console_scripts": [
            "vpn-shop=bot:entrypoint",
          ],
        },
    )
    EOF
  '';
}