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

34 lines
785 B
Nix
Raw Normal View History

2023-12-29 16:43:40 +01:00
{ config, lib, pkgs, ... }:
2023-12-30 23:39:33 +01:00
let cfg = config.jopejoe1.moodle-dl;
in {
2023-12-29 16:43:40 +01:00
options.jopejoe1.moodle-dl = {
enable = lib.mkEnableOption "Enable moodle-dl";
};
config = lib.mkIf cfg.enable {
systemd.timers."moodle-dl" = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "1h";
Unit = "moodle-dl.service";
};
};
systemd.services."moodle-dl" = {
script = ''
2024-04-25 14:54:14 +02:00
moodle-dl --path /var/lib/moodle-dl
git -C /var/lib/moodle-dl add .
git -C /var/lib/moodle-dl commit -m "moodle-dl updated on `$(date)`"
2023-12-29 16:43:40 +01:00
'';
2024-04-25 14:54:14 +02:00
path = with pkgs; [ openssh moodle-dl git coreutils ];
2023-12-29 16:43:40 +01:00
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
};
}