summaryrefslogtreecommitdiff
path: root/pkgs/bookwyrm.nix
blob: 5720d4c64e7074eae0949b0f71a8d4f0e1d3c7b9 (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
78
79
80
81
82
83
84
85
86
{ lib
, fetchFromGitHub
, python
}:


python.pkgs.buildPythonApplication rec {
  pname = "bookwyrm";
  version = "0.7.2";

  format = "other";

  src = fetchFromGitHub {
    owner = "bookwyrm-social";
    repo = "bookwyrm";
    rev = "refs/tags/v${version}";
    hash = "sha256-5QhIHpNUn65qTh7ARlnGfUESoxw8hqFaoS2D2z+OSlM=";
  };

  propagatedBuildInputs = with python.pkgs; [
    aiohttp
    bleach
    celery
    colorthief
    django
    django-celery-beat
    bw-file-resubmit
    django-compressor
    django-imagekit
    django-model-utils
    django-sass-processor
    django-csp
    environs
    flower
    gunicorn
    libsass
    markdown
    packaging
    pillow
    psycopg2
    pycryptodome
    dateutil
    redis
    requests
    responses
    pytz
    boto3
    django-storages
    django-redis
    opentelemetry-api
    opentelemetry-exporter-otlp-proto-grpc
    # opentelemetry-instrumentation-celery
    opentelemetry-instrumentation-django
    # opentelemetry-instrumentation-pyscopg2
    opentelemetry-sdk
    protobuf
    pyotp
    qrcode
    grpcio
  ];

  postBuild = ''
    # TODO: nice build input for customisable settings
    cp .env.example .env
    substituteInPlace .env --replace " = (1024**2 * 100)" "=10000000"
    substituteInPlace .env --replace "7(2w1sedok=aznpq)ta1mc4i%4h=xx@hxwx*o57ctsuml0x%fr" "asdjtuledjijkhtjphkedjjstihwhod"
    python manage.py compile_themes
    python manage.py collectstatic --no-input
  '';

  postInstall = ''
    mkdir -p $out
    cp -r static bookwyrm celerywyrm $out
  '';

  passthru = {
    pythonPath = python.pkgs.makePythonPath propagatedBuildInputs;
    gunicorn = python.pkgs.gunicorn;
    celery = python.pkgs.celery;
  };

  # hacky hacky hack
  shellHook = ''
    export PYTHONPATH=${passthru.pythonPath}
  '';
}