From a7b32b6df563a944e75d0a7d9f19c60891b7bb9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 17 Jan 2024 14:04:23 +0200 Subject: [PATCH] nixosModules.e11sync: remove ${system} --- flake.nix | 60 ++++++++++++++++------------------------ pkgs/e11sync-backend.nix | 4 +-- 2 files changed, 26 insertions(+), 38 deletions(-) diff --git a/flake.nix b/flake.nix index 1164ba8..affe638 100644 --- a/flake.nix +++ b/flake.nix @@ -39,44 +39,26 @@ pkgs = import nixpkgs { inherit system; overlays = [ - (_: super: { - python3 = super.python3.override { - packageOverrides = _: python-super: { - django = python-super.django_5; + (_: prev: { + python3 = prev.python3.override { + packageOverrides = _: python-prev: { + 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 { - packages = { - inherit geoip-mmdb; - inherit e11sync-static; - inherit e11sync-frontend; - inherit e11sync-backend; - }; - 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 { src = ./.; hooks = { @@ -92,8 +74,9 @@ ''; }; - nixosModules.e11sync = e11sync-module; - nixosModules.default = e11sync-module; + packages = { + inherit (pkgs) e11sync-static e11sync-frontend e11sync-backend; + }; apps = { e11sync-frontend = { @@ -109,7 +92,7 @@ debug } :8001 - ${builtins.readFile "${e11sync-frontend}"} + ${builtins.readFile "${pkgs.e11sync-frontend}"} ''; }} --adapter caddyfile''); }; @@ -118,7 +101,7 @@ name = "e11sync-backend"; program = toString (pkgs.writeShellScript "wrapper" '' 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 dart-sass ]; - GEOIP_PATH = "${geoip-mmdb}"; + GEOIP_PATH = "${pkgs.geoip-mmdb}"; E11SYNC_DEBUG = "1"; LOCALE_ARCHIVE = "${pkgs.glibcLocales}/lib/locale/locale-archive"; inherit (self.checks.${system}.pre-commit-check) shellHook; @@ -156,5 +139,10 @@ 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 e244713..4ba03a1 100644 --- a/pkgs/e11sync-backend.nix +++ b/pkgs/e11sync-backend.nix @@ -10,7 +10,7 @@ backendPort ? 8002, databasePath ? null, geoip-mmdb, - e11sync-static-manifest, + e11sync-static, }: 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-manifest}" \ + --set E11SYNC_STATIC_ROOT "${e11sync-static.passthru.manifest}" \ --set E11SYNC_COMPRESS_OFFLINE 1 \ --set E11SYNC_DEBUG "" \ --set GEOIP_PATH "${geoip-mmdb}" \