diff options
author | stuebinm | 2024-02-11 17:14:24 +0100 |
---|---|---|
committer | stuebinm | 2024-02-11 17:14:24 +0100 |
commit | 074a6ffb981a7c97876dcb93e0d5c2113a9bd74c (patch) | |
tree | 69880436b140b675009434cd5101a5711f18528a | |
parent | 062d966cb4790437dbd5050c3fb84925a0fa3a96 (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 '')
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | ilex/configuration.nix | 12 | ||||
-rw-r--r-- | pkgs/bookwyrm.nix | 86 | ||||
-rw-r--r-- | pkgs/overlay.nix | 12 | ||||
-rw-r--r-- | pkgs/python/bw-file-resubmit.nix | 27 | ||||
-rw-r--r-- | pkgs/python/django-imagekit.nix | 30 | ||||
-rw-r--r-- | pkgs/python/django-sass-processor.nix | 30 |
7 files changed, 196 insertions, 3 deletions
@@ -141,7 +141,7 @@ kijetesantakaluotokieni showrt isabelle-utils isabat travelynx crs-tracker crs-php bahnhof-name matrix-to hikari_unstable heartwood radicle-interface radicle-tui - inweb nomsring; + inweb nomsring bookwyrm; }; nixosModules = { glitchtip = import ./modules/glitchtip.nix; }; diff --git a/ilex/configuration.nix b/ilex/configuration.nix index 0f0e528..70ca74d 100644 --- a/ilex/configuration.nix +++ b/ilex/configuration.nix @@ -7,7 +7,7 @@ { imports = [ ./hardware-configuration.nix - ../modules/glitchtip.nix + # ../modules/glitchtip.nix ../modules/crs-tools.nix ]; @@ -40,7 +40,7 @@ services.postgresql = { enable = true; - ensureDatabases = [ "tracktrain" "glitchtrip" "crstracker" "travelynx" ]; + ensureDatabases = [ "tracktrain" "glitchtrip" "crstracker" "travelynx" "bookwyrm" ]; ensureUsers = [ { name = "tracktrain"; ensureDBOwnership = true; @@ -51,6 +51,9 @@ name = "glitchtrip"; ensureDBOwnership = true; } { + name = "bookwyrm"; + ensureDBOwnership = true; + } { name = "crstracker"; ensureDBOwnership = true; } ]; @@ -62,6 +65,11 @@ # package = pkgs.postgresql_11; }; + services.redis.servers."bookwyrm" = { + enable = true; + port = 6379; + }; + # services.glitchtip = { # enable = true; # databaseUrl = "postgres://glitchtrip@localhost:5432/glitchtrip"; 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} + ''; +} diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index 671a7c2..6e654b3 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -134,6 +134,18 @@ in #### packaged mostly as shitpost / to play around with #### + bookwyrm = (self.callPackage ./bookwyrm.nix { + python = super.python311.override ({ + packageOverrides = self: super: { + django = super.django_3; + python-crontab = super.python-crontab.overridePythonAttrs (_: { doCheck = false; }); + django-sass-processor = self.callPackage ./python/django-sass-processor.nix {}; + django-imagekit = self.callPackage ./python/django-imagekit.nix {}; + bw-file-resubmit = self.callPackage ./python/bw-file-resubmit.nix {}; + }; + }); + }); + glitchtip = (self.callPackage ./glitchtip.nix { python = super.python310.override ({ packageOverrides = self: super: { diff --git a/pkgs/python/bw-file-resubmit.nix b/pkgs/python/bw-file-resubmit.nix new file mode 100644 index 0000000..b21234f --- /dev/null +++ b/pkgs/python/bw-file-resubmit.nix @@ -0,0 +1,27 @@ +{ lib +, buildPythonPackage +, fetchPypi +, django +, python +, setuptools +}: + +buildPythonPackage rec { + pname = "bw-file-resubmit"; + version = "0.6.0rc2"; + format = "pyproject"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-wWZcRMRTCYCIOKtgaIQPIqxZ+8T49cZVsBXm0bJT+Ew="; + }; + + propagatedBuildInputs = [ + django + setuptools + ]; + + nativeCheckInputs = [ + django + ]; +} diff --git a/pkgs/python/django-imagekit.nix b/pkgs/python/django-imagekit.nix new file mode 100644 index 0000000..9a11a4f --- /dev/null +++ b/pkgs/python/django-imagekit.nix @@ -0,0 +1,30 @@ +{ lib +, buildPythonPackage +, fetchPypi +, django-appconf +, pilkit +, django +, python +}: + +buildPythonPackage rec { + pname = "django-imagekit"; + version = "4.1.0"; + format = "setuptools"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-5VmuquQ6M7NPh2Man6VpZFXkRR/6c4pCY1/eRC/trFw="; + }; + + propagatedBuildInputs = [ + django-appconf + pilkit + ]; + + nativeCheckInputs = [ + django + ]; + + doCheck = false; +} diff --git a/pkgs/python/django-sass-processor.nix b/pkgs/python/django-sass-processor.nix new file mode 100644 index 0000000..90bba5f --- /dev/null +++ b/pkgs/python/django-sass-processor.nix @@ -0,0 +1,30 @@ +{ lib +, buildPythonPackage +, fetchPypi +, django-compressor +, libsass +, django +, python +}: + +buildPythonPackage rec { + pname = "django-sass-processor"; + version = "1.2.2"; + format = "setuptools"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-9gmMGBzJWiFZPfa7UCeR4yAVYVIigD3iFv3Mi7QsD3c="; + }; + + propagatedBuildInputs = [ + django-compressor + libsass + ]; + + nativeCheckInputs = [ + django + ]; + + doCheck = false; +} |