summaryrefslogtreecommitdiff
path: root/pkgs/bookwyrm.nix
diff options
context:
space:
mode:
authorstuebinm2024-02-11 17:14:24 +0100
committerstuebinm2024-02-11 17:14:24 +0100
commit074a6ffb981a7c97876dcb93e0d5c2113a9bd74c (patch)
tree69880436b140b675009434cd5101a5711f18528a /pkgs/bookwyrm.nix
parent062d966cb4790437dbd5050c3fb84925a0fa3a96 (diff)
pkgs: init bookwyrm
this is still missing: - a nice way to do settings - lots of testing (run the manage.py test script in a nixos test?) - an actual way to deploy this in a halfway reasonable way
Diffstat (limited to 'pkgs/bookwyrm.nix')
-rw-r--r--pkgs/bookwyrm.nix86
1 files changed, 86 insertions, 0 deletions
diff --git a/pkgs/bookwyrm.nix b/pkgs/bookwyrm.nix
new file mode 100644
index 0000000..5720d4c
--- /dev/null
+++ b/pkgs/bookwyrm.nix
@@ -0,0 +1,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}
+ '';
+}