3 ms·
NixOS includes a cron daemon (Vixie cron), and you can add crontab entries directly either as strings or as files: https://search.nixos.org/options?channel=21.0
by pxc 5y ago
NixOS includes a cron daemon (Vixie cron), and you can add crontab entries directly either as strings or as files: https://search.nixos.org/options?channel=21.05&show=services.cron.enable&from=0&size=50&sort=relevance&type=options&query=services.cron https://search.nixos.org/options?channel=21.05&show=services...
You can use, e.g.,
services.cron.enable = true;
services.cron.systemCronJobs = [ ''
*/30 * * * * someuser bash /path/to/some/script/idk.sh
'' ];
or if you really don't want to worry about the Nix syntax for a list of strings, and possible escaping issues, you can just create a crontab file in /etc/nixos next to configuration.nix and write
services.cron.cronFiles = [
./crontab
];