mirror of
https://codeberg.org/jopejoe1/nix-conf.git
synced 2025-06-07 05:19:22 +02:00
move nixos modules to nixos-modules
This commit is contained in:
parent
7394c5f317
commit
611796f02e
29 changed files with 225 additions and 7 deletions
44
nixos-modules/moodle-dl/default.nix
Normal file
44
nixos-modules/moodle-dl/default.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.jopejoe1.moodle-dl;
|
||||
in
|
||||
{
|
||||
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 = ''
|
||||
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)`"
|
||||
'';
|
||||
path = with pkgs; [
|
||||
openssh
|
||||
moodle-dl
|
||||
git
|
||||
coreutils
|
||||
];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue