uwsgi: move package overrides to e11sync-backend
This commit is contained in:
parent
74efa197b5
commit
d3c5d73198
@ -63,7 +63,6 @@
|
|||||||
|
|
||||||
e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {
|
e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {
|
||||||
inherit geoip-mmdb;
|
inherit geoip-mmdb;
|
||||||
uwsgi = pkgs.uwsgi.override {plugins = ["python3"];};
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
packages = {
|
packages = {
|
||||||
|
@ -11,55 +11,57 @@
|
|||||||
backendPort ? 8002,
|
backendPort ? 8002,
|
||||||
database-path ? null,
|
database-path ? null,
|
||||||
geoip-mmdb,
|
geoip-mmdb,
|
||||||
}:
|
}: let
|
||||||
stdenv.mkDerivation {
|
uwsgi-python = uwsgi.override {plugins = ["python3"];};
|
||||||
name = "e11sync-backend";
|
in
|
||||||
propagatedBuildInputs = [
|
stdenv.mkDerivation {
|
||||||
(python3.withPackages
|
name = "e11sync-backend";
|
||||||
(ps: [
|
propagatedBuildInputs = [
|
||||||
ps.django
|
(python3.withPackages
|
||||||
ps.django-compressor
|
(ps: [
|
||||||
ps.geoip2
|
ps.django
|
||||||
]))
|
ps.django-compressor
|
||||||
libmaxminddb
|
ps.geoip2
|
||||||
];
|
]))
|
||||||
nativeBuildInputs = [makeWrapper];
|
libmaxminddb
|
||||||
src = ../app;
|
];
|
||||||
patchPhase = ''patchShebangs --build manage.py'';
|
nativeBuildInputs = [makeWrapper];
|
||||||
buildPhase = ''mkdir -p $out'';
|
src = ../app;
|
||||||
installPhase = ''
|
patchPhase = ''patchShebangs --build manage.py'';
|
||||||
cp -r . $out/app
|
buildPhase = ''mkdir -p $out'';
|
||||||
makeWrapper $out/app/manage.py $out/bin/e11sync \
|
installPhase = ''
|
||||||
--set GEOIP_PATH "${geoip-mmdb}"
|
cp -r . $out/app
|
||||||
|
makeWrapper $out/app/manage.py $out/bin/e11sync \
|
||||||
|
--set GEOIP_PATH "${geoip-mmdb}"
|
||||||
|
|
||||||
makeWrapper ${uwsgi}/bin/uwsgi $out/bin/e11sync-backend \
|
makeWrapper ${uwsgi-python}/bin/uwsgi $out/bin/e11sync-backend \
|
||||||
--chdir $out/app \
|
--chdir $out/app \
|
||||||
--set-default E11SYNC_HTTP_PORT ${toString backendPort} \
|
--set-default E11SYNC_HTTP_PORT ${toString backendPort} \
|
||||||
--add-flags "--plugin ${uwsgi}/lib/uwsgi/python3_plugin.so" \
|
--add-flags "--plugin ${uwsgi-python}/lib/uwsgi/python3_plugin.so" \
|
||||||
--add-flags "--http-socket 127.0.0.1:${toString backendPort}" \
|
--add-flags "--http-socket 127.0.0.1:${toString backendPort}" \
|
||||||
--add-flags "--wsgi-file e11sync/wsgi.py" \
|
--add-flags "--wsgi-file e11sync/wsgi.py" \
|
||||||
--add-flags --master \
|
--add-flags --master \
|
||||||
${lib.optionalString (database-path != null) ''
|
${lib.optionalString (database-path != null) ''
|
||||||
--set E11SYNC_DATABASE_PATH "${database-path}" \
|
--set E11SYNC_DATABASE_PATH "${database-path}" \
|
||||||
''} \
|
''} \
|
||||||
--set E11SYNC_DEBUG "" \
|
--set E11SYNC_DEBUG "" \
|
||||||
--set E11SYNC_COMPRESS_OFFLINE 1 \
|
--set E11SYNC_COMPRESS_OFFLINE 1 \
|
||||||
--set GEOIP_PATH "${geoip-mmdb}" \
|
--set GEOIP_PATH "${geoip-mmdb}" \
|
||||||
'';
|
|
||||||
passthru.tests.unit =
|
|
||||||
runCommand "e11sync-test" {
|
|
||||||
src = ../app;
|
|
||||||
buildInputs = [
|
|
||||||
python3Packages.django
|
|
||||||
python3Packages.django-compressor
|
|
||||||
python3Packages.geoip2
|
|
||||||
dart-sass
|
|
||||||
];
|
|
||||||
} ''
|
|
||||||
unpackPhase
|
|
||||||
patchShebangs --build app/manage.py
|
|
||||||
export GEOIP_PATH="${geoip-mmdb}"
|
|
||||||
app/manage.py test app
|
|
||||||
mkdir -p $out
|
|
||||||
'';
|
'';
|
||||||
}
|
passthru.tests.unit =
|
||||||
|
runCommand "e11sync-test" {
|
||||||
|
src = ../app;
|
||||||
|
buildInputs = [
|
||||||
|
python3Packages.django
|
||||||
|
python3Packages.django-compressor
|
||||||
|
python3Packages.geoip2
|
||||||
|
dart-sass
|
||||||
|
];
|
||||||
|
} ''
|
||||||
|
unpackPhase
|
||||||
|
patchShebangs --build app/manage.py
|
||||||
|
export GEOIP_PATH="${geoip-mmdb}"
|
||||||
|
app/manage.py test app
|
||||||
|
mkdir -p $out
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user