diff --git a/flake.nix b/flake.nix index affe638..1164ba8 100644 --- a/flake.nix +++ b/flake.nix @@ -39,26 +39,44 @@ pkgs = import nixpkgs { inherit system; overlays = [ - (_: prev: { - python3 = prev.python3.override { - packageOverrides = _: python-prev: { - django = python-prev.django_5; + (_: super: { + python3 = super.python3.override { + packageOverrides = _: python-super: { + django = python-super.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 { + packages = { + inherit geoip-mmdb; + inherit e11sync-static; + inherit e11sync-frontend; + inherit e11sync-backend; + }; + checks = { - e11sync-unit = pkgs.e11sync-backend.passthru.tests.unit; + e11sync-unit = e11sync-backend.passthru.tests.unit; pre-commit-check = pre-commit-hooks.lib.${system}.run { src = ./.; hooks = { @@ -74,9 +92,8 @@ ''; }; - packages = { - inherit (pkgs) e11sync-static e11sync-frontend e11sync-backend; - }; + nixosModules.e11sync = e11sync-module; + nixosModules.default = e11sync-module; apps = { e11sync-frontend = { @@ -92,7 +109,7 @@ debug } :8001 - ${builtins.readFile "${pkgs.e11sync-frontend}"} + ${builtins.readFile "${e11sync-frontend}"} ''; }} --adapter caddyfile''); }; @@ -101,7 +118,7 @@ name = "e11sync-backend"; program = toString (pkgs.writeShellScript "wrapper" '' export E11SYNC_DATABASE_PATH=$PWD/db.sqlite3 - exec ${pkgs.e11sync-backend}/bin/e11sync-backend + exec ${e11sync-backend}/bin/e11sync-backend ''); }; }; @@ -122,7 +139,7 @@ libmaxminddb dart-sass ]; - GEOIP_PATH = "${pkgs.geoip-mmdb}"; + GEOIP_PATH = "${geoip-mmdb}"; E11SYNC_DEBUG = "1"; LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; inherit (self.checks.${system}.pre-commit-check) shellHook; @@ -139,10 +156,5 @@ self.nixosModules.x86_64-linux.e11sync ]; }; - - nixosModules = rec { - e11sync = import ./modules/e11sync {}; - nixosModules.default = e11sync; - }; }; } diff --git a/pkgs/e11sync-backend.nix b/pkgs/e11sync-backend.nix index 4ba03a1..e244713 100644 --- a/pkgs/e11sync-backend.nix +++ b/pkgs/e11sync-backend.nix @@ -10,7 +10,7 @@ backendPort ? 8002, databasePath ? null, geoip-mmdb, - e11sync-static, + e11sync-static-manifest, }: let uwsgi-python = uwsgi.override {plugins = ["python3"];}; pythonEnv = @@ -50,7 +50,7 @@ in ${lib.optionalString (databasePath != null) '' --set E11SYNC_DATABASE_PATH "${databasePath}" \ ''} \ - --set E11SYNC_STATIC_ROOT "${e11sync-static.passthru.manifest}" \ + --set E11SYNC_STATIC_ROOT "${e11sync-static-manifest}" \ --set E11SYNC_COMPRESS_OFFLINE 1 \ --set E11SYNC_DEBUG "" \ --set GEOIP_PATH "${geoip-mmdb}" \