Remove broken Bookwyrm and Python packages

This commit is contained in:
Reinout Meliesie 2026-04-28 18:40:09 +02:00
commit 75390937cd
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
8 changed files with 6 additions and 562 deletions

View file

@ -3,60 +3,17 @@
with pkgs ;
{
imports = [
packages/bookwyrm/nixos-module.nix
] ;
nixpkgs = {
overlays = [
( self : super : {
kernelmaft = {
bookwyrm = callPackage (
import packages/bookwyrm/package.nix
) {} ;
journalctl-last-invocation = callPackage (
import packages/journalctl-last-invocation/package.nix
) {} ;
journalctl-last-invocation = callPackage (
import packages/journalctl-last-invocation/package.nix
) {} ;
nix-store-fuzzy-find = callPackage (
import packages/nix-store-fuzzy-find/package.nix
) {} ;
python = {
bw-file-resubmit = callPackage (
import packages/python3.11-bw-file-resubmit/package.nix
) {} ;
django-imagekit = callPackage (
import packages/python3.11-django-imagekit/package.nix
) {} ;
django-pgtrigger = callPackage (
import packages/python3.11-django-pgtrigger/package.nix
) {} ;
django-sass-processor = callPackage (
import packages/python3.11-django-sass-processor/package.nix
) {} ;
s3-tar = callPackage (
import packages/python3.11-s3-tar/package.nix
) {} ;
} ;
} ;
# TODO: Use the following template once the custom Python packages have been converted to use `buildPythonPackage`
#
# python311 = super . python311 . override {
# packageOverrides = python-self : python-super : {
# package-name = super . callPackage ( import ./package-file.nix ) {} ;
# } ;
# } ;
nix-store-fuzzy-find = callPackage (
import packages/nix-store-fuzzy-find/package.nix
) {} ;
} )
] ;

View file

@ -1,93 +0,0 @@
{ pkgs , ... } :
with pkgs ;
with pkgs . kernelmaft ;
{
systemd = {
units = {
"bookwyrm.service" = {
text = ''
[Unit]
After=network.target
[Service]
# 'initdb' fails harmlessly if it has been run on the database before
ExecStartPre=${coreutils-full}/bin/ln -sf ${bookwyrm}/var/lib/bookwyrm/VERSION /var/lib/bookwyrm/
ExecStartPre=${coreutils-full}/bin/mkdir -p /var/lib/bookwyrm/images
ExecStartPre=${bookwyrm}/bin/bookwyrm-env ${python311}/bin/python ${bookwyrm}/lib/python3.11/manage.py migrate
ExecStartPre=-${bookwyrm}/bin/bookwyrm-env ${python311}/bin/python ${bookwyrm}/lib/python3.11/manage.py initdb
ExecStart=${bookwyrm}/bin/bookwyrm-env ${bookwyrm}/bin/bookwyrm
WorkingDirectory=/var/lib/bookwyrm
# Creates /var/lib/bookwyrm directory
StateDirectory=bookwyrm
# Creates /run/bookwyrm directory
RuntimeDirectory=bookwyrm
User=bookwyrm
Group=bookwyrm
ProtectSystem=strict
ProtectHome=tmpfs
PrivateTmp=true
PrivateDevices=true
PrivateIPC=true
ProtectHostname=true
ProtectClock=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
RestrictNamespaces=true
LockPersonality=true
RestrictRealtime=true
RestrictSUIDSGID=true
'' ;
} ;
} ;
} ;
users = {
groups = {
bookwyrm = {} ;
} ;
users = {
bookwyrm = {
group = "bookwyrm" ;
home = "/var/lib/bookwyrm" ;
isSystemUser = true ;
} ;
} ;
} ;
services = {
postgresql = {
ensureUsers = [
{
name = "bookwyrm" ;
ensureDBOwnership = true ;
}
] ;
ensureDatabases = [ "bookwyrm" ] ;
} ;
redis = {
servers = {
bookwyrm-activity = {
enable = true ;
user = "bookwyrm" ;
group = "bookwyrm" ;
} ;
bookwyrm-broker = {
enable = true ;
user = "bookwyrm" ;
group = "bookwyrm" ;
} ;
} ;
} ;
} ;
}

View file

@ -1,199 +0,0 @@
{
fetchFromGitHub ,
pkgs ,
stdenv ,
} :
with builtins ;
with pkgs ;
with pkgs . kernelmaft . python ;
with pkgs . python311Packages ;
with stdenv ;
let
pythonDependencies = [
aiohappyeyeballs
aiohttp
aiosignal
amqp
asgiref
attrs
billiard
bleach
boto3
botocore
bw-file-resubmit
celery
certifi
cffi
chardet
click
colorthief
cron-descriptor
cryptography
deprecated
django
django-appconf
django-celery-beat
django-csp
django-imagekit
django-model-utils
django-oauth-toolkit
django-pgtrigger
django-sass-processor
django-storages
django-timezone-field
environs
frozenlist
googleapis-common-protos
grpcio
idna
importlib-metadata
jmespath
jwcrypto
kombu
libsass
markdown
marshmallow
multidict
oauthlib
packaging
pilkit
pillow
protobuf
psycopg2
pycryptodome
pyotp
python-crontab
python-dateutil
python-dotenv
qrcode
redis
requests
s3-tar
s3transfer
six
sqlparse
typing-extensions
urllib3
vine
webencodings
wrapt
yarl
] ;
in
mkDerivation {
pname = "bookwyrm" ;
version = "2025-02-14-ba1f180" ;
src = fetchFromGitea {
domain = "kernelmaft.com/forgejo" ;
owner = "zedfrigg" ;
repo = "bookwyrm" ;
rev = "229a035a2be1811123b5afcb035fab61d13f0a47" ;
hash = "sha256-0pwszQwx/RsCv3pxGifyAEpzXfTBiwOOt+h3pZuN3Bk=" ;
} ;
dontPatch = true ;
dontConfigure = true ;
buildPhase = ''
runHook preBuild
mkdir -p /build/lib/python3.11/site-packages
# Python dependencies
for dependency in ${ concatStringsSep " " pythonDependencies } ; do
ln -sf $dependency/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
done
export PYTHONPATH=/build/lib/python3.11/site-packages
export DOMAIN=""
export EMAIL=""
export EMAIL_HOST=""
export EMAIL_HOST_USER=""
export EMAIL_HOST_PASSWORD=""
export SECRET_KEY=""
${python311}/bin/python manage.py compile_themes
${python311}/bin/python manage.py collectstatic --no-input
runHook postBuild
'' ;
installPhase = ''
runHook preInstall
# Python packages
mkdir -p $out/lib/python3.11/site-packages
for dependency in ${ concatStringsSep " " pythonDependencies } ; do
ln -sf $dependency/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
done
cp -r /build/source/bookwyrm $out/lib/python3.11/site-packages/
cp -r /build/source/celerywyrm $out/lib/python3.11/site-packages/
# Python scripts
cp /build/source/manage.py $out/lib/python3.11/
# Static web files
mkdir -p $out/srv/http
cp -r /build/source/static/* $out/srv/http/
ln -s \
${source-han-sans}/share/fonts/opentype/source-han-sans/SourceHanSans.ttc \
$out/srv/http/fonts/source_han_sans/SourceHanSans-VF.ttf.ttc
# Executables
mkdir -p $out/bin
cat <<- EOF > $out/bin/bookwyrm
#!${bash}/bin/sh
exec ${gunicorn}/bin/gunicorn bookwyrm.wsgi:application --bind=unix:/run/bookwyrm/http-socket
EOF
cat <<- EOF > $out/bin/bookwyrm-env
#!${bash}/bin/sh
PATH=${coreutils-full}/bin
if [ \$( id -un ) != "bookwyrm" -o \$( id -gn ) != "bookwyrm" ] ; then
echo "You are not running as the 'bookwyrm' user and group, quitting"
exit 1
fi
export PYTHONPATH=$out/lib/python3.11/site-packages
export DEBUG=false
export STATIC_ROOT_ABS=$out/srv/http
exec \$@
EOF
chmod +x $out/bin/*
# Working directory contents
mkdir -p $out/var/lib/bookwyrm
cp $src/VERSION $out/var/lib/bookwyrm/
runHook postInstall
'' ;
}

View file

@ -1,40 +0,0 @@
{
fetchFromGitHub ,
pkgs ,
stdenv ,
} :
with pkgs . python311Packages ;
with stdenv ;
mkDerivation {
pname = "python-bw-file-resubmit" ;
version = "2023-11-08-0655eb2" ;
src = fetchFromGitHub {
owner = "bookwyrm-social" ;
repo = "bw-file-resubmit" ;
rev = "0655eb24d77b5440f0221df99d87bbb1ea588181" ;
hash = "sha256-RT3fF2oMsf0klUwMBJ02Dgdt2rsoB7A3SjiuyVuYU7A=" ;
} ;
dontPatch = true ;
dontConfigure = true ;
dontBuild = true ;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/python3.11/site-packages
# Dependencies
ln -s ${django}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
# The package itself
cp -r $src/src/file_resubmit $out/lib/python3.11/site-packages/
runHook postInstall
'' ;
}

View file

@ -1,42 +0,0 @@
{
fetchFromGitHub ,
pkgs ,
stdenv ,
} :
with pkgs . python311Packages ;
with stdenv ;
mkDerivation {
pname = "python-django-imagekit" ;
version = "2024-07-22-4cbbc52" ;
src = fetchFromGitHub {
owner = "matthewwithanm" ;
repo = "django-imagekit" ;
rev = "4cbbc52fabfd99a6306cdbb8ab2602bb0a0190a9" ;
hash = "sha256-QYWhXh404JNAZN7kXYhsPQpFpyBA/MehxJOxdDKX0Mc=" ;
} ;
dontPatch = true ;
dontConfigure = true ;
dontBuild = true ;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/python3.11/site-packages
# Dependencies
ln -s ${django}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
ln -s ${django-appconf}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
ln -s ${pilkit}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
# The package itself
cp -r $src/imagekit $out/lib/python3.11/site-packages/
runHook postInstall
'' ;
}

View file

@ -1,51 +0,0 @@
{
fetchFromGitHub ,
pkgs ,
stdenv ,
} :
with pkgs . python311Packages ;
with stdenv ;
mkDerivation {
pname = "python-django-pgtrigger" ;
version = "4.13.3" ;
src = fetchFromGitHub {
owner = "ambitioneng" ;
repo = "django-pgtrigger" ;
rev = "4.13.3" ;
hash = "sha256-K+JjAermtSiVUnPbtyabpQN2ghnRIkwt329Ytp8zeQk=" ;
} ;
dontPatch = true ;
dontConfigure = true ;
dontBuild = true ;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/python3.11/site-packages/django_pgtrigger-4.13.3.dist-info
mkdir -p $out/lib/python3.11/site-packages/pgtrigger
# Dependencies
ln -s ${django}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
ln -s ${psycopg}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
# The package itself
cp $src/pgtrigger/*.py $out/lib/python3.11/site-packages/pgtrigger/
cp -r $src/pgtrigger/management $out/lib/python3.11/site-packages/pgtrigger/
# Metadata
cat << EOF > $out/lib/python3.11/site-packages/django_pgtrigger-4.13.3.dist-info/METADATA
Metadata-Version: 2.1
Name: django-pgtrigger
Version: 4.13.3
EOF
runHook postInstall
'' ;
}

View file

@ -1,47 +0,0 @@
{
fetchFromGitHub ,
pkgs ,
stdenv ,
} :
with pkgs . python311Packages ;
with stdenv ;
mkDerivation {
pname = "python-django-sass-processor" ;
version = "1.4.1" ;
src = fetchFromGitHub {
owner = "jrief" ;
repo = "django-sass-processor" ;
rev = "1.4.1" ;
hash = "sha256-Z3UzzkHlMNiyhj7YPRDgAX0437BywPG/waNSPoNiKLo=" ;
} ;
dontPatch = true ;
dontConfigure = true ;
dontBuild = true ;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/python3.11/site-packages/sass_processor
# Dependencies
ln -s ${django}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
ln -s ${django-compressor}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
ln -s ${jinja2}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
ln -s ${libsass}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
# The package itself
cp $src/sass_processor/*.py $out/lib/python3.11/site-packages/sass_processor/
cp -r $src/sass_processor/management $out/lib/python3.11/site-packages/sass_processor/
cp -r $src/sass_processor/templatetags $out/lib/python3.11/site-packages/sass_processor/
cp -r $src/sass_processor/jinja2 $out/lib/python3.11/site-packages/sass_processor/
runHook postInstall
'' ;
}

View file

@ -1,41 +0,0 @@
{
fetchFromGitHub ,
pkgs,
stdenv ,
} :
with pkgs . python311Packages ;
with stdenv ;
mkDerivation {
pname = "python-s3-tar" ;
version = "2020-08-05-62f7f11" ;
src = fetchFromGitHub {
owner = "xtream1101" ;
repo = "s3-tar" ;
rev = "62f7f1118f9e83724dbf9e8458b5505b3a0ba758" ;
hash = "sha256-s2ei0joUNDZ2e18YbjMMlGOJpuMTFUwEjgRiUGb4EqI=" ;
} ;
dontPatch = true ;
dontConfigure = true ;
dontBuild = true ;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/python3.11/site-packages
# Dependencies
ln -s ${boto3}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
ln -s ${botocore}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
# The package itself
cp -r $src/s3_tar $out/lib/python3.11/site-packages/
runHook postInstall
'' ;
}