nix-dotfiles/hosts/tsuki/services/scrapers/nhk-easy-news/default.nix

33 lines
982 B
Nix
Raw Normal View History

2023-07-12 01:57:20 +02:00
{ config, pkgs, lib, ... }: let
cfg = config.systemd.services.scrape-nhk-easy-news;
script = pkgs.writers.writePython3 "scrape-nhk-easy-news.py" {
libraries = with pkgs.python3Packages; [ requests wget ];
} (lib.fileContents ./script.py);
in {
systemd.services.scrape-nhk-easy-news = {
after = [ "network.target" ];
2024-01-23 05:51:37 +01:00
serviceConfig = rec {
2023-07-12 01:57:20 +02:00
Type = "oneshot";
ExecStart = script;
DynamicUser = true;
PrivateTmp = true;
ProtectHome = true;
ProtectProc = "invisible";
ProtectSystem = "strict";
2024-01-23 05:24:47 +01:00
WorkingDirectory = "/data/scrapers/nhk-easy-news";
2024-01-23 05:51:37 +01:00
BindPaths = [ WorkingDirectory ];
ReadWritePaths = [ WorkingDirectory ];
StateDirectory = "nhk-easy-news-scraper";
StateDirectoryMode = "0755";
2023-07-12 01:57:20 +02:00
};
};
systemd.timers.scrape-nhk-easy-news = {
wantedBy = [ "timers.target" ];
timerConfig = {
Unit = "scrape-nhk-easy-news.service";
OnCalendar = "*-*-* 03:00:00";
};
};
}