1
Fork 0

nixosModules.e11sync: remove ${system}

This commit is contained in:
Motiejus Jakštys 2024-01-17 14:04:23 +02:00
parent 92dc1f97cc
commit a7b32b6df5
2 changed files with 26 additions and 38 deletions

View File

@ -39,44 +39,26 @@
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ overlays = [
(_: super: { (_: prev: {
python3 = super.python3.override { python3 = prev.python3.override {
packageOverrides = _: python-super: { packageOverrides = _: python-prev: {
django = python-super.django_5; django = python-prev.django_5;
}; };
}; };
}) })
(_: prev: {
geoip-mmdb = prev.callPackage ./pkgs/geoip-mmdb.nix {
inherit geoip2-tarball;
};
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {};
e11sync-frontend = pkgs.callPackage ./pkgs/e11sync-frontend.nix {};
e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {};
})
]; ];
}; };
geoip-mmdb = pkgs.callPackage ./pkgs/geoip-mmdb.nix {
inherit geoip2-tarball;
};
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {};
e11sync-frontend = pkgs.callPackage ./pkgs/e11sync-frontend.nix {
inherit e11sync-static;
};
e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {
inherit geoip-mmdb;
e11sync-static-manifest = e11sync-static.passthru.manifest;
};
e11sync-module = import ./modules/e11sync {
inherit e11sync-backend e11sync-frontend;
};
in { in {
packages = {
inherit geoip-mmdb;
inherit e11sync-static;
inherit e11sync-frontend;
inherit e11sync-backend;
};
checks = { checks = {
e11sync-unit = e11sync-backend.passthru.tests.unit; e11sync-unit = pkgs.e11sync-backend.passthru.tests.unit;
pre-commit-check = pre-commit-hooks.lib.${system}.run { pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.; src = ./.;
hooks = { hooks = {
@ -92,8 +74,9 @@
''; '';
}; };
nixosModules.e11sync = e11sync-module; packages = {
nixosModules.default = e11sync-module; inherit (pkgs) e11sync-static e11sync-frontend e11sync-backend;
};
apps = { apps = {
e11sync-frontend = { e11sync-frontend = {
@ -109,7 +92,7 @@
debug debug
} }
:8001 :8001
${builtins.readFile "${e11sync-frontend}"} ${builtins.readFile "${pkgs.e11sync-frontend}"}
''; '';
}} --adapter caddyfile''); }} --adapter caddyfile'');
}; };
@ -118,7 +101,7 @@
name = "e11sync-backend"; name = "e11sync-backend";
program = toString (pkgs.writeShellScript "wrapper" '' program = toString (pkgs.writeShellScript "wrapper" ''
export E11SYNC_DATABASE_PATH=$PWD/db.sqlite3 export E11SYNC_DATABASE_PATH=$PWD/db.sqlite3
exec ${e11sync-backend}/bin/e11sync-backend exec ${pkgs.e11sync-backend}/bin/e11sync-backend
''); '');
}; };
}; };
@ -139,7 +122,7 @@
libmaxminddb libmaxminddb
dart-sass dart-sass
]; ];
GEOIP_PATH = "${geoip-mmdb}"; GEOIP_PATH = "${pkgs.geoip-mmdb}";
E11SYNC_DEBUG = "1"; E11SYNC_DEBUG = "1";
LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive";
inherit (self.checks.${system}.pre-commit-check) shellHook; inherit (self.checks.${system}.pre-commit-check) shellHook;
@ -156,5 +139,10 @@
self.nixosModules.x86_64-linux.e11sync self.nixosModules.x86_64-linux.e11sync
]; ];
}; };
nixosModules = rec {
e11sync = import ./modules/e11sync {};
nixosModules.default = e11sync;
};
}; };
} }

View File

@ -10,7 +10,7 @@
backendPort ? 8002, backendPort ? 8002,
databasePath ? null, databasePath ? null,
geoip-mmdb, geoip-mmdb,
e11sync-static-manifest, e11sync-static,
}: let }: let
uwsgi-python = uwsgi.override {plugins = ["python3"];}; uwsgi-python = uwsgi.override {plugins = ["python3"];};
pythonEnv = pythonEnv =
@ -50,7 +50,7 @@ in
${lib.optionalString (databasePath != null) '' ${lib.optionalString (databasePath != null) ''
--set E11SYNC_DATABASE_PATH "${databasePath}" \ --set E11SYNC_DATABASE_PATH "${databasePath}" \
''} \ ''} \
--set E11SYNC_STATIC_ROOT "${e11sync-static-manifest}" \ --set E11SYNC_STATIC_ROOT "${e11sync-static.passthru.manifest}" \
--set E11SYNC_COMPRESS_OFFLINE 1 \ --set E11SYNC_COMPRESS_OFFLINE 1 \
--set E11SYNC_DEBUG "" \ --set E11SYNC_DEBUG "" \
--set GEOIP_PATH "${geoip-mmdb}" \ --set GEOIP_PATH "${geoip-mmdb}" \