summaryrefslogtreecommitdiff
path: root/pkgs/mautrix-instagram/default.nix
blob: 14cb1c60ddb2d33d0c4878d46c550080154e7751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ stdenv
, lib
, python3
, makeWrapper
, fetchFromGitHub
}:

with python3.pkgs;

let
  # officially supported database drivers
  dbDrivers = [
    asyncpg
    # sqlite driver is already shipped with python by default
  ];

in

buildPythonApplication rec {
  pname = "mautrix-instagram";
  version = "unstable-2021-11-15";

  src = fetchFromGitHub {
    owner = "tulir";
    repo = pname;
    rev = "13b6b157b6eaff5c34506a458aa761362aad8c64";
    sha256 = "1xkjcmh31pzli3dck2glg0a64x59n4x05zjmg2v65rcfz8snb1mw";
  };

  postPatch = ''
    sed -i -e '/alembic>/d' requirements.txt
  '';
  postFixup = ''
    makeWrapper ${python}/bin/python $out/bin/mautrix-instagram \
      --add-flags "-m mautrix_instagram" \
      --prefix PYTHONPATH : "$(toPythonPath ${mautrix}):$(toPythonPath $out):$PYTHONPATH"
  '';

  propagatedBuildInputs = [
    mautrix
    yarl
    aiohttp
    aiosqlite
    beautifulsoup4
    sqlalchemy
    CommonMark
    ruamel_yaml
    paho-mqtt
    python_magic
    attrs
    pillow
    qrcode
    phonenumbers
    pycryptodome
    python-olm
    unpaddedbase64
    setuptools
  ] ++ dbDrivers;

  checkInputs = [
    pytest
    pytestrunner
    pytest-mock
    pytest-asyncio
  ];

  doCheck = false;

  meta = with lib; {
    homepage = "https://github.com/tulir/mautrix-instagram";
    description = "A Matrix-Instagram DM puppeting bridge";
    license = licenses.agpl3Plus;
    platforms = platforms.linux;
  };

}