top-level modules: make work
This commit is contained in:
parent
a382d78d63
commit
f0a32ae9ae
@ -125,6 +125,8 @@
|
|||||||
self.nixosModules.e11sync
|
self.nixosModules.e11sync
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
nixosModules.e11sync = import ./modules/e11sync nixpkgs;
|
nixosModules.e11sync = import ./modules/e11sync {
|
||||||
|
inherit nixpkgs geoip2-tarball;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
nixpkgs: {
|
{
|
||||||
|
nixpkgs,
|
||||||
|
geoip2-tarball,
|
||||||
|
}: {
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
system,
|
pkgs,
|
||||||
geoip2-tarball,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: 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 {
|
in {
|
||||||
options.e11sync = with lib.types; {
|
options.e11sync = with lib.types; {
|
||||||
enable = lib.mkEnableOption "Enable e11sync";
|
enable = lib.mkEnableOption "Enable e11sync";
|
||||||
@ -34,7 +37,7 @@ in {
|
|||||||
in
|
in
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.e11sync-backend
|
pkgs1.e11sync-backend
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.services = {
|
systemd.services = {
|
||||||
@ -59,7 +62,7 @@ in {
|
|||||||
StateDirectory = "e11sync-backend";
|
StateDirectory = "e11sync-backend";
|
||||||
WorkingDirectory = "/var/lib/e11sync-backend";
|
WorkingDirectory = "/var/lib/e11sync-backend";
|
||||||
KillSignal = "SIGQUIT";
|
KillSignal = "SIGQUIT";
|
||||||
ExecStart = "${pkgs.e11sync-backend}/bin/e11sync-backend";
|
ExecStart = "${pkgs1.e11sync-backend}/bin/e11sync-backend";
|
||||||
|
|
||||||
MemoryHigh = "1535M";
|
MemoryHigh = "1535M";
|
||||||
MemoryMax = "4096M";
|
MemoryMax = "4096M";
|
||||||
@ -71,7 +74,7 @@ in {
|
|||||||
ProtectControlGroups = true;
|
ProtectControlGroups = true;
|
||||||
}
|
}
|
||||||
(lib.mkIf cfg.migrateOnStart {
|
(lib.mkIf cfg.migrateOnStart {
|
||||||
ExecStartPre = "${pkgs.e11sync-backend}/bin/e11sync migrate";
|
ExecStartPre = "${pkgs1.e11sync-backend}/bin/e11sync migrate";
|
||||||
})
|
})
|
||||||
(lib.mkIf (cfg.secretKeyPath != "unsafe") {
|
(lib.mkIf (cfg.secretKeyPath != "unsafe") {
|
||||||
LoadCredential = "secret_key:${cfg.secretKeyPath}";
|
LoadCredential = "secret_key:${cfg.secretKeyPath}";
|
||||||
@ -81,6 +84,6 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.caddy.virtualHosts."${cfg.vhost}".extraConfig =
|
services.caddy.virtualHosts."${cfg.vhost}".extraConfig =
|
||||||
builtins.readFile "${pkgs.e11sync-frontend}";
|
builtins.readFile "${pkgs1.e11sync-frontend}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
16
pkgs.nix
16
pkgs.nix
@ -3,9 +3,7 @@
|
|||||||
system,
|
system,
|
||||||
geoip2-tarball,
|
geoip2-tarball,
|
||||||
}: let
|
}: let
|
||||||
inherit (import nixpkgs {inherit system;}) callPackage;
|
pkgs = import nixpkgs {
|
||||||
in
|
|
||||||
import nixpkgs {
|
|
||||||
inherit system;
|
inherit system;
|
||||||
overlays = [
|
overlays = [
|
||||||
(_: super: {
|
(_: super: {
|
||||||
@ -14,12 +12,14 @@ in
|
|||||||
django = python-super.django_5;
|
django = python-super.django_5;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
geoip-mmdb = callPackage ./pkgs/geoip-mmdb.nix {
|
geoip-mmdb = pkgs.callPackage ./pkgs/geoip-mmdb.nix {
|
||||||
inherit geoip2-tarball;
|
inherit geoip2-tarball;
|
||||||
};
|
};
|
||||||
e11sync-static = callPackage ./pkgs/e11sync-static.nix {};
|
e11sync-static = pkgs.callPackage ./pkgs/e11sync-static.nix {};
|
||||||
e11sync-frontend = callPackage ./pkgs/e11sync-frontend.nix {};
|
e11sync-frontend = pkgs.callPackage ./pkgs/e11sync-frontend.nix {};
|
||||||
e11sync-backend = callPackage ./pkgs/e11sync-backend.nix {};
|
e11sync-backend = pkgs.callPackage ./pkgs/e11sync-backend.nix {};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
};
|
||||||
|
in
|
||||||
|
pkgs
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
backendPort ? 8002,
|
backendPort ? 8002,
|
||||||
databasePath ? null,
|
databasePath ? null,
|
||||||
geoip-mmdb,
|
geoip-mmdb,
|
||||||
e11sync-static-manifest,
|
e11sync-static,
|
||||||
}: let
|
}: let
|
||||||
uwsgi-python = uwsgi.override {plugins = ["python3"];};
|
uwsgi-python = uwsgi.override {plugins = ["python3"];};
|
||||||
pythonEnv =
|
pythonEnv =
|
||||||
@ -50,7 +50,7 @@ in
|
|||||||
${lib.optionalString (databasePath != null) ''
|
${lib.optionalString (databasePath != null) ''
|
||||||
--set E11SYNC_DATABASE_PATH "${databasePath}" \
|
--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_COMPRESS_OFFLINE 1 \
|
||||||
--set E11SYNC_DEBUG "" \
|
--set E11SYNC_DEBUG "" \
|
||||||
--set GEOIP_PATH "${geoip-mmdb}" \
|
--set GEOIP_PATH "${geoip-mmdb}" \
|
||||||
|
Loading…
Reference in New Issue
Block a user