118 lines
2.2 KiB
Nix
118 lines
2.2 KiB
Nix
|
{
|
||
|
fetchFromGitHub ,
|
||
|
pkgs ,
|
||
|
stdenv ,
|
||
|
} :
|
||
|
|
||
|
with builtins ;
|
||
|
with pkgs . kernelmaft . python ;
|
||
|
with pkgs . python311Packages ;
|
||
|
with stdenv ;
|
||
|
|
||
|
mkDerivation {
|
||
|
pname = "bookwyrm" ;
|
||
|
version = "2025-02-14-ba1f180" ;
|
||
|
|
||
|
src = fetchFromGitHub {
|
||
|
owner = "bookwyrm-social" ;
|
||
|
repo = "bookwyrm" ;
|
||
|
rev = "ba1f180c834e1b84d33e565abc3d95f772e2cdd8" ;
|
||
|
hash = "sha256-8e1+pfURTvzsWumRpeBZGDyD8UW1C98Vv9/1GqECLD4=" ;
|
||
|
} ;
|
||
|
|
||
|
dontPatch = true ;
|
||
|
dontConfigure = true ;
|
||
|
dontBuild = true ;
|
||
|
|
||
|
installPhase = let
|
||
|
dependencies = [
|
||
|
aiohappyeyeballs
|
||
|
aiohttp
|
||
|
aiosignal
|
||
|
amqp
|
||
|
asgiref
|
||
|
attrs
|
||
|
billiard
|
||
|
bleach
|
||
|
bw-file-resubmit
|
||
|
celery
|
||
|
certifi
|
||
|
cffi
|
||
|
click
|
||
|
colorthief
|
||
|
cron-descriptor
|
||
|
cryptography
|
||
|
django
|
||
|
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
|
||
|
idna
|
||
|
jmespath
|
||
|
jwcrypto
|
||
|
kombu
|
||
|
markdown
|
||
|
marshmallow
|
||
|
multidict
|
||
|
oauthlib
|
||
|
pillow
|
||
|
psycopg2
|
||
|
pycryptodome
|
||
|
python-crontab
|
||
|
python-dateutil
|
||
|
python-dotenv
|
||
|
requests
|
||
|
s3-tar
|
||
|
six
|
||
|
sqlparse
|
||
|
typing-extensions
|
||
|
urllib3
|
||
|
vine
|
||
|
webencodings
|
||
|
yarl
|
||
|
] ;
|
||
|
in ''
|
||
|
runHook preInstall
|
||
|
|
||
|
mkdir -p $out/lib/python3.11/site-packages
|
||
|
|
||
|
${ concatStringsSep "\n" ( map ( package : ''
|
||
|
ln -s ${package}/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
|
||
|
'' ) dependencies ) }
|
||
|
|
||
|
# rm $out/lib/python3.11/site-packages/__pycache__
|
||
|
|
||
|
cp -r $src/bookwyrm $out/lib/python3.11/site-packages/
|
||
|
cp -r $src/celerywyrm $out/lib/python3.11/site-packages/
|
||
|
|
||
|
mkdir -p $out/bin
|
||
|
|
||
|
cat << EOF > $out/bin/bookwyrm
|
||
|
#!/run/current-system/sw/bin/sh
|
||
|
|
||
|
export PYTHONPATH="$out/lib/python3.11/site-packages"
|
||
|
|
||
|
export DEBUG=false
|
||
|
export DOMAIN=""
|
||
|
export EMAIL=""
|
||
|
export EMAIL_HOST=""
|
||
|
export EMAIL_HOST_USER=""
|
||
|
export EMAIL_HOST_PASSWORD=""
|
||
|
export SECRET_KEY="\$( cat /etc/nixos/assets/bookwyrm-secret-key )" # The escape here is required in order to retrieve the key file contents at runtime
|
||
|
|
||
|
${gunicorn}/bin/gunicorn bookwyrm.wsgi:application
|
||
|
EOF
|
||
|
|
||
|
chmod +x $out/bin/bookwyrm
|
||
|
|
||
|
runHook postInstall
|
||
|
'' ;
|
||
|
}
|