nixos/applications/pelican/panel/panel.nix

76 lines
1.6 KiB
Nix
Raw Permalink Normal View History

2024-12-10 00:43:48 +00:00
{
inputs,
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.modules.pelican-panel;
dir = "/var/www/pelican";
in {
options = {
modules.pelican-panel = {
enable = mkEnableOption "Pelican Panel";
};
};
config = mkIf cfg.enable {
environment.systemPackages = [
pkgs.curl
pkgs.gnutar
pkgs.unzip
pkgs.php83
pkgs.php83Packages.composer
pkgs.php83Extensions.gd
pkgs.php83Extensions.mysqli
pkgs.php83Extensions.mbstring
pkgs.php83Extensions.bcmath
pkgs.php83Extensions.xml
pkgs.php83Extensions.curl
pkgs.php83Extensions.zip
pkgs.php83Extensions.intl
pkgs.php83Extensions.sqlite3
2024-12-10 00:43:48 +00:00
(import ./pelican-install.nix {
inherit pkgs;
inherit dir;
})
(import ./pelican-update.nix {
inherit pkgs;
inherit dir;
})
];
systemd.timers."pelican-cron" = {
2024-12-10 00:43:48 +00:00
wantedBy = ["timers.target"];
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "1m";
Unit = "pelican-cron.service";
};
};
systemd.services."pelican-cron" = {
script = ''
${pkgs.php83}/bin/php ${dir}/artisan schedule:run >> /dev/null 2>&1
'';
serviceConfig = {
Type = "oneshot";
};
};
systemd.services.pelican-queue = {
2024-12-10 00:43:48 +00:00
wantedBy = ["multi-user.target"];
serviceConfig = {
2024-12-10 00:43:48 +00:00
User = "nginx";
Group = "nginx";
Restart = "always";
ExecStart = "${pkgs.php83}/bin/php ${dir}/artisan queue:work --tries=3";
startLimitInterval = 180;
startLimitBurst = 30;
RestartSec = "5";
};
};
};
2024-12-10 00:43:48 +00:00
}