1
Fork 0

top-level modules: make work

This commit is contained in:
Motiejus Jakštys 2024-01-19 15:12:30 +02:00
parent a382d78d63
commit f0a32ae9ae
4 changed files with 24 additions and 19 deletions

View File

@ -125,6 +125,8 @@
self.nixosModules.e11sync
];
};
nixosModules.e11sync = import ./modules/e11sync nixpkgs;
nixosModules.e11sync = import ./modules/e11sync {
inherit nixpkgs geoip2-tarball;
};
};
}

View File

@ -1,11 +1,14 @@
nixpkgs: {
{
nixpkgs,
geoip2-tarball,
}: {
config,
lib,
system,
geoip2-tarball,
pkgs,
...
}: let
pkgs = import ../../pkgs.nix {inherit nixpkgs system geoip2-tarball;};
inherit (pkgs.stdenv.hostPlatform) system;
pkgs1 = import ../../pkgs.nix {inherit nixpkgs system geoip2-tarball;};
in {
options.e11sync = with lib.types; {
enable = lib.mkEnableOption "Enable e11sync";
@ -34,7 +37,7 @@ in {
in
lib.mkIf cfg.enable {
environment.systemPackages = [
pkgs.e11sync-backend
pkgs1.e11sync-backend
];
systemd.services = {
@ -59,7 +62,7 @@ in {
StateDirectory = "e11sync-backend";
WorkingDirectory = "/var/lib/e11sync-backend";
KillSignal = "SIGQUIT";
ExecStart = "${pkgs.e11sync-backend}/bin/e11sync-backend";
ExecStart = "${pkgs1.e11sync-backend}/bin/e11sync-backend";
MemoryHigh = "1535M";
MemoryMax = "4096M";
@ -71,7 +74,7 @@ in {
ProtectControlGroups = true;
}
(lib.mkIf cfg.migrateOnStart {
ExecStartPre = "${pkgs.e11sync-backend}/bin/e11sync migrate";
ExecStartPre = "${pkgs1.e11sync-backend}/bin/e11sync migrate";
})
(lib.mkIf (cfg.secretKeyPath != "unsafe") {
LoadCredential = "secret_key:${cfg.secretKeyPath}";
@ -81,6 +84,6 @@ in {
};
services.caddy.virtualHosts."${cfg.vhost}".extraConfig =
builtins.readFile "${pkgs.e11sync-frontend}";
builtins.readFile "${pkgs1.e11sync-frontend}";
};
}

View File

@ -3,9 +3,7 @@
system,
geoip2-tarball,
}: let
inherit (import nixpkgs {inherit system;}) callPackage;
in
import nixpkgs {
pkgs = import nixpkgs {
inherit system;
overlays = [
(_: super: {
@ -14,12 +12,14 @@ in
django = python-super.django_5;
};
};
geoip-mmdb = callPackage ./pkgs/geoip-mmdb.nix {
geoip-mmdb = pkgs.callPackage ./pkgs/geoip-mmdb.nix {
inherit geoip2-tarball;
};
e11sync-static = callPackage ./pkgs/e11sync-static.nix {};
e11sync-frontend = callPackage ./pkgs/e11sync-frontend.nix {};
e11sync-backend = callPackage ./pkgs/e11sync-backend.nix {};
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {};
e11sync-frontend = pkgs.callPackage ./pkgs/e11sync-frontend.nix {};
e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {};
})
];
}
};
in
pkgs

View File

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