nix-conf/modules/services/moodle-dl/default.nix

27 lines
720 B
Nix
Raw Normal View History

2023-11-03 08:44:40 +01:00
{ lib, pkgs, ... }:
{
systemd.timers."moodle-dl" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5m";
2023-11-03 08:48:02 +01:00
OnUnitActiveSec = "1h";
2023-11-03 08:44:40 +01:00
Unit = "moodle-dl.service";
};
};
systemd.services."moodle-dl" = {
script = ''
2023-11-03 16:40:56 +01:00
${pkgs.coreutils}/bin/echo "yes" | ${lib.getExe pkgs.moodle-dl} --path /var/moodle-dl --add-all-visible-courses
2023-11-03 14:18:41 +01:00
${lib.getExe pkgs.moodle-dl} --path /var/moodle-dl
2023-11-03 15:21:17 +01:00
${lib.getExe pkgs.git} -C /var/moodle-dl add .
2023-11-03 08:44:40 +01:00
${lib.getExe pkgs.git} -C /var/moodle-dl commit -m "moodle-dl updated on `$(${pkgs.coreutils}/bin/date)`"
'';
path = [pkgs.openssh];
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
}