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 {
|
||||
inherit geoip-mmdb;
|
||||
uwsgi = pkgs.uwsgi.override {plugins = ["python3"];};
|
||||
};
|
||||
in {
|
||||
packages = {
|
||||
|
|
|
@ -11,55 +11,57 @@
|
|||
backendPort ? 8002,
|
||||
database-path ? null,
|
||||
geoip-mmdb,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
name = "e11sync-backend";
|
||||
propagatedBuildInputs = [
|
||||
(python3.withPackages
|
||||
(ps: [
|
||||
ps.django
|
||||
ps.django-compressor
|
||||
ps.geoip2
|
||||
]))
|
||||
libmaxminddb
|
||||
];
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
src = ../app;
|
||||
patchPhase = ''patchShebangs --build manage.py'';
|
||||
buildPhase = ''mkdir -p $out'';
|
||||
installPhase = ''
|
||||
cp -r . $out/app
|
||||
makeWrapper $out/app/manage.py $out/bin/e11sync \
|
||||
--set GEOIP_PATH "${geoip-mmdb}"
|
||||
}: let
|
||||
uwsgi-python = uwsgi.override {plugins = ["python3"];};
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
name = "e11sync-backend";
|
||||
propagatedBuildInputs = [
|
||||
(python3.withPackages
|
||||
(ps: [
|
||||
ps.django
|
||||
ps.django-compressor
|
||||
ps.geoip2
|
||||
]))
|
||||
libmaxminddb
|
||||
];
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
src = ../app;
|
||||
patchPhase = ''patchShebangs --build manage.py'';
|
||||
buildPhase = ''mkdir -p $out'';
|
||||
installPhase = ''
|
||||
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 \
|
||||
--chdir $out/app \
|
||||
--set-default E11SYNC_HTTP_PORT ${toString backendPort} \
|
||||
--add-flags "--plugin ${uwsgi}/lib/uwsgi/python3_plugin.so" \
|
||||
--add-flags "--http-socket 127.0.0.1:${toString backendPort}" \
|
||||
--add-flags "--wsgi-file e11sync/wsgi.py" \
|
||||
--add-flags --master \
|
||||
${lib.optionalString (database-path != null) ''
|
||||
--set E11SYNC_DATABASE_PATH "${database-path}" \
|
||||
''} \
|
||||
--set E11SYNC_DEBUG "" \
|
||||
--set E11SYNC_COMPRESS_OFFLINE 1 \
|
||||
--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
|
||||
makeWrapper ${uwsgi-python}/bin/uwsgi $out/bin/e11sync-backend \
|
||||
--chdir $out/app \
|
||||
--set-default E11SYNC_HTTP_PORT ${toString backendPort} \
|
||||
--add-flags "--plugin ${uwsgi-python}/lib/uwsgi/python3_plugin.so" \
|
||||
--add-flags "--http-socket 127.0.0.1:${toString backendPort}" \
|
||||
--add-flags "--wsgi-file e11sync/wsgi.py" \
|
||||
--add-flags --master \
|
||||
${lib.optionalString (database-path != null) ''
|
||||
--set E11SYNC_DATABASE_PATH "${database-path}" \
|
||||
''} \
|
||||
--set E11SYNC_DEBUG "" \
|
||||
--set E11SYNC_COMPRESS_OFFLINE 1 \
|
||||
--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
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue