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;
};
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {
inherit self;
};
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {};
e11sync = pkgs.callPackage ./pkgs/e11sync.nix {
inherit self geoip-archive;
};
e11sync = pkgs.callPackage ./pkgs/e11sync.nix {inherit geoip-archive;};
in {
packages.geoip-archive = geoip-archive;
packages.e11sync-static = e11sync-static;

View File

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

View File

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