Reuse Python deps between phases and split by dir structure
This commit is contained in:
parent
6f7d8ae4ce
commit
2e83d0e020
1 changed files with 90 additions and 154 deletions
|
@ -10,101 +10,8 @@ with pkgs . kernelmaft . python ;
|
||||||
with pkgs . python311Packages ;
|
with pkgs . python311Packages ;
|
||||||
with stdenv ;
|
with stdenv ;
|
||||||
|
|
||||||
mkDerivation {
|
let
|
||||||
pname = "bookwyrm" ;
|
simplePythonDependencies = [
|
||||||
version = "2025-02-14-ba1f180" ;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "bookwyrm-social" ;
|
|
||||||
repo = "bookwyrm" ;
|
|
||||||
rev = "ba1f180c834e1b84d33e565abc3d95f772e2cdd8" ;
|
|
||||||
hash = "sha256-8e1+pfURTvzsWumRpeBZGDyD8UW1C98Vv9/1GqECLD4=" ;
|
|
||||||
} ;
|
|
||||||
|
|
||||||
dontPatch = true ;
|
|
||||||
dontConfigure = true ;
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
|
|
||||||
mkdir -p /build/lib/python3.11/site-packages
|
|
||||||
|
|
||||||
ln -sf ${aiohappyeyeballs}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${aiohttp}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${aiosignal}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${amqp}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${asgiref}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${attrs}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${billiard}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${bleach}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${boto3}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${botocore}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${bw-file-resubmit}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${celery}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${certifi}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${cffi}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${click}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${colorthief}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${cron-descriptor}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${cryptography}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-celery-beat}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-csp}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-imagekit}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-model-utils}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-oauth-toolkit}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-pgtrigger}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-sass-processor}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-storages}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${django-timezone-field}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${environs}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${frozenlist}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${idna}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${jmespath}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${jwcrypto}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${kombu}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${libsass}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${markdown}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${marshmallow}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${multidict}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${oauthlib}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${packaging}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${pillow}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${psycopg2}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${pycryptodome}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${pyotp}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${python-crontab}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${python-dateutil}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${python-dotenv}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${qrcode}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${redis}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${requests}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${s3-tar}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${s3transfer}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${six}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${sqlparse}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${typing-extensions}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${urllib3}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${vine}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${webencodings}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
ln -sf ${yarl}/lib/python3.11/site-packages/* /build/lib/python3.11/site-packages/
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
runHook postBuild
|
|
||||||
'' ;
|
|
||||||
|
|
||||||
installPhase = let
|
|
||||||
pythonDependencies = [
|
|
||||||
aiohappyeyeballs
|
aiohappyeyeballs
|
||||||
aiohttp
|
aiohttp
|
||||||
aiosignal
|
aiosignal
|
||||||
|
@ -166,8 +73,8 @@ mkDerivation {
|
||||||
python-crontab
|
python-crontab
|
||||||
python-dateutil
|
python-dateutil
|
||||||
python-dotenv
|
python-dotenv
|
||||||
qrcode # I.e. python311Packages . qrcode
|
qrcode
|
||||||
redis # I.e. python311Packages . redis
|
redis
|
||||||
requests
|
requests
|
||||||
s3-tar
|
s3-tar
|
||||||
s3transfer
|
s3transfer
|
||||||
|
@ -180,7 +87,50 @@ mkDerivation {
|
||||||
wrapt
|
wrapt
|
||||||
yarl
|
yarl
|
||||||
] ;
|
] ;
|
||||||
in ''
|
|
||||||
|
overlappingPythonDependencies = [] ;
|
||||||
|
in
|
||||||
|
|
||||||
|
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 ;
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
mkdir -p /build/lib/python3.11/site-packages
|
||||||
|
|
||||||
|
# Python dependencies
|
||||||
|
|
||||||
|
for dependency in "${ concatStringsSep " " simplePythonDependencies }" ; 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
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
|
'' ;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
@ -189,23 +139,9 @@ mkDerivation {
|
||||||
|
|
||||||
# Python dependencies
|
# Python dependencies
|
||||||
|
|
||||||
pythonDependencies="${ concatStringsSep " " pythonDependencies }"
|
for dependency in "${ concatStringsSep " " simplePythonDependencies }" ; do
|
||||||
|
ln -sf $dependency/lib/python3.11/site-packages/* $out/lib/python3.11/site-packages/
|
||||||
for package in $pythonDependencies ; do
|
|
||||||
for directory in $( cd $package/lib/python3.11/site-packages ; find -mindepth 1 -type d -not -name __pycache__ ) ; do
|
|
||||||
mkdir -p $out/lib/python3.11/site-packages/$directory &
|
|
||||||
done
|
done
|
||||||
done
|
|
||||||
|
|
||||||
wait
|
|
||||||
|
|
||||||
for package in $pythonDependencies ; do
|
|
||||||
for file in $( cd $package/lib/python3.11/site-packages ; find -type f -not -path \*__pycache__\* ) ; do
|
|
||||||
ln -s $package/lib/python3.11/site-packages/$file $out/lib/python3.11/site-packages/$file &
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
wait
|
|
||||||
|
|
||||||
# Python packages
|
# Python packages
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue