nix-config/modules/timers/rooms.nix
2025-09-16 23:54:10 +02:00

35 lines
712 B
Nix

{
lib,
config,
...
}: let
inherit (lib) mkEnableOption mkIf;
cfg = config.horseman.timers.rooms;
in {
options = {
horseman.timers.rooms = {
enable = mkEnableOption "Runs a script to search for student housing";
};
};
config = mkIf cfg.enable {
systemd.timers."rooms" = {
wantedBy = ["timers.target"];
timerConfig = {
OnCalendar = "*-*-* 23:00:00"; # Every day at 23:00
Persistent = true;
};
};
systemd.services."rooms" = {
script = ''
cd /home/horseman/Programming
java -jar KamerZoeken-1.0.0.jar headless
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
};
}