1
Fork 0

flakes: get rid of `self`

This commit is contained in:
Motiejus Jakštys 2024-01-15 07:50:38 +02:00
parent 2bcc5a8585
commit e17646b070
3 changed files with 11 additions and 18 deletions

View File

@ -35,13 +35,9 @@
inherit geoip2-asn geoip2-city geoip2-country; inherit geoip2-asn geoip2-city geoip2-country;
}; };
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix { e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {};
inherit self;
};
e11sync = pkgs.callPackage ./pkgs/e11sync.nix { e11sync = pkgs.callPackage ./pkgs/e11sync.nix {inherit geoip-archive;};
inherit self geoip-archive;
};
in { in {
packages.geoip-archive = geoip-archive; packages.geoip-archive = geoip-archive;
packages.e11sync-static = e11sync-static; packages.e11sync-static = e11sync-static;

View File

@ -1,5 +1,4 @@
{ {
self,
stdenv, stdenv,
python3Packages, python3Packages,
coreutils, coreutils,
@ -10,20 +9,20 @@
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "e11sync-static"; name = "e11sync-static";
src = self; src = ../app;
nativeBuildInputs = [ nativeBuildInputs = [
python3Packages.django_5 python3Packages.django_5
python3Packages.django-compressor python3Packages.django-compressor
dart-sass dart-sass
]; ];
patchPhase = ''patchShebangs --build app/manage.py''; patchPhase = ''patchShebangs --build manage.py'';
buildPhase = '' buildPhase = ''
mkdir -p static mkdir -p static
export E11SYNC_STATIC_ROOT=static export E11SYNC_STATIC_ROOT=static
export E11SYNC_DEBUG= export E11SYNC_DEBUG=
export E11SYNC_COMPRESS_OFFLINE=1 export E11SYNC_COMPRESS_OFFLINE=1
app/manage.py collectstatic ./manage.py collectstatic
app/manage.py compress ./manage.py compress
${findutils}/bin/find static/CACHE -name '*.css' | \ ${findutils}/bin/find static/CACHE -name '*.css' | \
${findutils}/bin/xargs -P''$(${coreutils}/bin/nproc) -I{} sh -c \ ${findutils}/bin/xargs -P''$(${coreutils}/bin/nproc) -I{} sh -c \

View File

@ -1,5 +1,4 @@
{ {
self,
lib, lib,
stdenv, stdenv,
runCommand, runCommand,
@ -20,11 +19,11 @@ stdenv.mkDerivation {
libmaxminddb libmaxminddb
]; ];
nativeBuildInputs = [makeWrapper]; nativeBuildInputs = [makeWrapper];
src = self; src = ../app;
patchPhase = ''patchShebangs --build app/manage.py''; patchPhase = ''patchShebangs --build manage.py'';
buildPhase = ''mkdir -p $out''; buildPhase = ''mkdir -p $out'';
installPhase = '' installPhase = ''
cp -r app $out cp -r . $out/app
makeWrapper ${python3Packages.gunicorn}/bin/gunicorn $out/bin/e11sync-gunicorn \ makeWrapper ${python3Packages.gunicorn}/bin/gunicorn $out/bin/e11sync-gunicorn \
--chdir $out/app \ --chdir $out/app \
--set-default E11SYNC_HTTP_PORT ${toString gunicornPort} \ --set-default E11SYNC_HTTP_PORT ${toString gunicornPort} \
@ -42,7 +41,7 @@ stdenv.mkDerivation {
''; '';
passthru.tests.unit = passthru.tests.unit =
runCommand "e11sync-test" { runCommand "e11sync-test" {
src = self; src = ../app;
buildInputs = [ buildInputs = [
python3Packages.django_5 python3Packages.django_5
python3Packages.django-compressor python3Packages.django-compressor
@ -51,8 +50,7 @@ stdenv.mkDerivation {
]; ];
} '' } ''
unpackPhase unpackPhase
patchShebangs --build $sourceRoot/app/manage.py patchShebangs --build app/manage.py
cd $sourceRoot
export GEOIP_PATH="${geoip-archive}" export GEOIP_PATH="${geoip-archive}"
app/manage.py test app app/manage.py test app
mkdir -p $out mkdir -p $out