From 66d8a424a260f3fbb4ca50863346778524f52a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 17 Jan 2024 15:02:59 +0200 Subject: [PATCH] vm bulds, but with django4 --- flake.nix | 9 ++++++++- modules/e11sync/default.nix | 22 ++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 1164ba8..c86905a 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,12 @@ django = python-super.django_5; }; }; + 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 {}; + e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {}; }) ]; }; @@ -153,8 +159,9 @@ modules = [ "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" ./vm.nix - self.nixosModules.x86_64-linux.e11sync + self.nixosModules.e11sync ]; }; + nixosModules.e11sync = import ./modules/e11sync geoip2-tarball; }; } diff --git a/modules/e11sync/default.nix b/modules/e11sync/default.nix index 92849cc..dfb16c1 100644 --- a/modules/e11sync/default.nix +++ b/modules/e11sync/default.nix @@ -1,9 +1,7 @@ -{ - e11sync-backend, - e11sync-frontend, -}: { +geoip2-tarball: { config, lib, + pkgs, ... }: { options.e11sync = with lib.types; { @@ -30,13 +28,21 @@ config = let cfg = config.e11sync; - pkg-backend = e11sync-backend.override { + 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 e11sync-static geoip-mmdb; inherit (cfg) backendPort databasePath; }; in lib.mkIf cfg.enable { environment.systemPackages = [ - pkg-backend + e11sync-backend ]; systemd.services = { @@ -61,7 +67,7 @@ StateDirectory = "e11sync-backend"; WorkingDirectory = "/var/lib/e11sync-backend"; KillSignal = "SIGQUIT"; - ExecStart = "${pkg-backend}/bin/e11sync-backend"; + ExecStart = "${e11sync-backend}/bin/e11sync-backend"; MemoryHigh = "1535M"; MemoryMax = "4096M"; @@ -73,7 +79,7 @@ ProtectControlGroups = true; } (lib.mkIf cfg.migrateOnStart { - ExecStartPre = "${pkg-backend}/bin/e11sync migrate"; + ExecStartPre = "${e11sync-backend}/bin/e11sync migrate"; }) (lib.mkIf (cfg.secretKeyPath != "unsafe") { LoadCredential = "secret_key:${cfg.secretKeyPath}";