From 40f010ce7d74b36725b1ebe49f2b0ee19645f89a Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Fri, 3 Nov 2023 08:44:40 +0100 Subject: [PATCH] Enable moodle-dl --- flake.nix | 5 +++-- modules/services/moodle-dl/default.nix | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 modules/services/moodle-dl/default.nix diff --git a/flake.nix b/flake.nix index 67f8ee4..fd6852a 100644 --- a/flake.nix +++ b/flake.nix @@ -114,8 +114,9 @@ ./modules/minecraft-server ./modules/kate ./modules/theming - #./modules/auto-update - #./modules/services/repo-sync + ./modules/auto-update + ./modules/services/repo-sync + ./modules/services/moodle-dl ./modules/users/jopejoe1 ./modules/users/root ./overlays diff --git a/modules/services/moodle-dl/default.nix b/modules/services/moodle-dl/default.nix new file mode 100644 index 0000000..34b4d4f --- /dev/null +++ b/modules/services/moodle-dl/default.nix @@ -0,0 +1,25 @@ +{ lib, pkgs, ... }: + +{ + systemd.timers."moodle-dl" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "5m"; + OnUnitActiveSec = "6h"; + Unit = "moodle-dl.service"; + }; + }; + + systemd.services."moodle-dl" = { + script = '' + ${lib.getExe pkgs.moodle-dl} + ${lib.getExe pkgs.git} -C /var/moodle-dl add * + ${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"; + }; + }; +}