move to systemd-timers

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
ahuston-0 2024-06-11 20:55:14 -04:00 committed by Alice Huston
parent 0dc66dac96
commit 9007fe4d53
2 changed files with 40 additions and 3 deletions

View File

@ -6,10 +6,10 @@
}:
{
imports = [
./cron
./networking.nix
./zfs.nix
./hydra.nix
./networking.nix
./nextcloud.nix
./zfs.nix
];
programs.git.lfs.enable = false;

View File

@ -0,0 +1,37 @@
{
config,
lib,
pkgs,
...
}:
{
systemd.timers."nextcloud-pre-generate" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = 600;
OnUnitActiveSec = 600;
Unit = "nextcloud-pre-generate.service";
};
};
systemd.services."nextcloud-pre-generate" = {
requires = [
"docker.service"
"multi-user.target"
];
after = [
"docker.service"
"multi-user.target"
];
description = "incrementally pre-generates previews on nextcloud";
serviceConfig = {
Type = "oneshot";
DynamicUser = "yes";
Group = "docker";
ExecStart = ''
docker ps --format "{{.Names}}" | grep -q "^nextcloud-nextcloud-1$" && docker exec --user www-data nextcloud-nextcloud-1 php occ preview:pre-generate
'';
};
};
}