add e11sync-uwsgi
This commit is contained in:
parent
81988555d2
commit
c291c5e0c9
54
flake.nix
54
flake.nix
@ -31,15 +31,26 @@
|
|||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (system: let
|
flake-utils.lib.eachDefaultSystem (system: let
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = import nixpkgs {inherit system;};
|
||||||
devDeps = with pkgs; [
|
uwsgiPort = 8001;
|
||||||
python3Packages.django_5
|
|
||||||
python3Packages.django-debug-toolbar
|
|
||||||
python3Packages.django-compressor
|
|
||||||
dart-sass
|
|
||||||
|
|
||||||
|
uwsgi = pkgs.uwsgi.override {
|
||||||
|
plugins = ["python3"];
|
||||||
|
python3 = pkgs.python3;
|
||||||
|
};
|
||||||
|
|
||||||
|
appDeps = with pkgs; [
|
||||||
|
python3Packages.django_5
|
||||||
|
python3Packages.django-compressor
|
||||||
|
];
|
||||||
|
runtimeDeps = with pkgs;
|
||||||
|
[
|
||||||
python3Packages.geoip2
|
python3Packages.geoip2
|
||||||
libmaxminddb
|
libmaxminddb
|
||||||
];
|
]
|
||||||
|
++ appDeps;
|
||||||
|
buildDeps = [pkgs.dart-sass] ++ appDeps;
|
||||||
|
debugDeps = [pkgs.python3Packages.django-debug-toolbar] ++ runtimeDeps;
|
||||||
|
|
||||||
geoip = pkgs.stdenv.mkDerivation {
|
geoip = pkgs.stdenv.mkDerivation {
|
||||||
name = "geoip";
|
name = "geoip";
|
||||||
srcs = [geoip2-asn geoip2-city geoip2-country];
|
srcs = [geoip2-asn geoip2-city geoip2-country];
|
||||||
@ -55,12 +66,7 @@
|
|||||||
packages.e11sync-static = pkgs.stdenv.mkDerivation {
|
packages.e11sync-static = pkgs.stdenv.mkDerivation {
|
||||||
name = "e11sync-static";
|
name = "e11sync-static";
|
||||||
src = self;
|
src = self;
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = buildDeps;
|
||||||
python3Packages.django_5
|
|
||||||
python3Packages.django-compressor
|
|
||||||
dart-sass
|
|
||||||
python3
|
|
||||||
];
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
mkdir -p $out/static
|
mkdir -p $out/static
|
||||||
export E11SYNC_STATIC_ROOT=$out/static
|
export E11SYNC_STATIC_ROOT=$out/static
|
||||||
@ -74,11 +80,33 @@
|
|||||||
"${pkgs.zopfli}/bin/zopfli {} && ${pkgs.brotli}/bin/brotli {}"
|
"${pkgs.zopfli}/bin/zopfli {} && ${pkgs.brotli}/bin/brotli {}"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
packages.e11sync-uwsgi = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "e11sync-uwsgi";
|
||||||
|
propagatedBuildInputs = [runtimeDeps];
|
||||||
|
nativeBuildInputs = [pkgs.makeWrapper];
|
||||||
|
src = self;
|
||||||
|
dontUnpack = true;
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir -p $out;
|
||||||
|
cp -r ${self}/app $out
|
||||||
|
makeWrapper ${uwsgi}/bin/uwsgi $out/bin/entrypoint-uwsgi \
|
||||||
|
--add-flags '\
|
||||||
|
--chdir='"$out"'/app \
|
||||||
|
--module=e11sync.wsgi:application \
|
||||||
|
--master \
|
||||||
|
--http-socket=127.0.0.1:${toString uwsgiPort} \
|
||||||
|
--processes=5 \
|
||||||
|
--harakiri=20 \
|
||||||
|
--max-requests=10000 \
|
||||||
|
--vacuum'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
devShells.default = pkgs.mkShellNoCC {
|
devShells.default = pkgs.mkShellNoCC {
|
||||||
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
|
||||||
GEOIP_PATH = "${geoip}";
|
GEOIP_PATH = "${geoip}";
|
||||||
E11SYNC_DEBUG = "1";
|
E11SYNC_DEBUG = "1";
|
||||||
packages = devDeps;
|
packages = debugDeps;
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter = pkgs.alejandra;
|
formatter = pkgs.alejandra;
|
||||||
|
Loading…
Reference in New Issue
Block a user