about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/matrix-synapse/plugins/s3-storage-provider.nix
blob: 9033049c33bdee3ec5ef9cdab5daa1849b8cff8b (plain) (blame)
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
{ lib
, boto3
, buildPythonPackage
, fetchFromGitHub
, humanize
, matrix-synapse-unwrapped
, pythonOlder
, tqdm
, twisted
, psycopg2
}:

buildPythonPackage rec {
  pname = "matrix-synapse-s3-storage-provider";
  version = "1.3.0";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "matrix-org";
    repo = "synapse-s3-storage-provider";
    rev = "refs/tags/v${version}";
    hash = "sha256-2mQjhZk3NsbjiGWoa/asGjhaKM3afXsCl633p6ZW0DY=";
  };

  postPatch = ''
    substituteInPlace setup.py \
      --replace "humanize>=0.5.1,<0.6" "humanize>=0.5.1"
  '';

  buildInputs = [
    matrix-synapse-unwrapped
  ];

  propagatedBuildInputs = [
    boto3
    humanize
    tqdm
    twisted
    psycopg2
  ]
  # For the s3_media_upload script
  ++ matrix-synapse-unwrapped.propagatedBuildInputs;

  # Tests need network access
  doCheck = false;

  pythonImportsCheck = [
    "s3_storage_provider"
  ];

  meta = with lib; {
    description = "Synapse storage provider to fetch and store media in Amazon S3";
    mainProgram = "s3_media_upload";
    homepage = "https://github.com/matrix-org/synapse-s3-storage-provider";
    changelog = "https://github.com/matrix-org/synapse-s3-storage-provider/releases/tag/v${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ yuka ];
  };
}