1
Fork 0

vm bulds, but with django4

This commit is contained in:
Motiejus Jakštys 2024-01-17 15:02:59 +02:00
parent 8bc0c13565
commit 66d8a424a2
2 changed files with 22 additions and 9 deletions

View File

@ -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;
};
}

View File

@ -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}";