diff options
| author | Ben Sima <ben@bsima.me> | 2025-08-13 13:36:30 -0400 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-08-28 12:14:09 -0400 |
| commit | 0b005c192b2c141c7f6c9bff4a0702361814c21d (patch) | |
| tree | 3527a76137f6ee4dd970bba17a93617a311149cb /Biz/PodcastItLater/Worker.nix | |
| parent | 7de0a3e0abbf1e152423e148d507e17b752a4982 (diff) | |
Prototype PodcastItLater
This implements a working prototype of PodcastItLater. It basically just works
for a single user currently, but the articles are nice to listen to and this is
something that we can start to build with.
Diffstat (limited to 'Biz/PodcastItLater/Worker.nix')
| -rw-r--r-- | Biz/PodcastItLater/Worker.nix | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/Biz/PodcastItLater/Worker.nix b/Biz/PodcastItLater/Worker.nix new file mode 100644 index 0000000..14aed9d --- /dev/null +++ b/Biz/PodcastItLater/Worker.nix @@ -0,0 +1,58 @@ +{ + options, + lib, + config, + pkgs, + ... +}: let + cfg = config.services.podcastitlater-worker; +in { + options.services.podcastitlater-worker = { + enable = lib.mkEnableOption "Enable the PodcastItLater worker service"; + dataDir = lib.mkOption { + type = lib.types.path; + default = "/var/podcastitlater"; + description = "Data directory for PodcastItLater (shared with web)"; + }; + package = lib.mkOption { + type = lib.types.package; + description = "PodcastItLater worker package to use"; + }; + }; + config = lib.mkIf cfg.enable { + systemd.services.podcastitlater-worker = { + path = [cfg.package pkgs.ffmpeg]; # ffmpeg needed for pydub + wantedBy = ["multi-user.target"]; + after = ["network.target"]; + preStart = '' + # Create data directory if it doesn't exist + mkdir -p ${cfg.dataDir} + + # Manual step: create this file with secrets + # OPENAI_API_KEY=your-openai-api-key + # S3_ENDPOINT=https://your-s3-endpoint.digitaloceanspaces.com + # S3_BUCKET=your-bucket-name + # S3_ACCESS_KEY=your-s3-access-key + # S3_SECRET_KEY=your-s3-secret-key + test -f /run/podcastitlater/worker-env + ''; + script = '' + ${cfg.package}/bin/podcastitlater-worker + ''; + description = '' + PodcastItLater Worker Service - processes articles to podcasts + ''; + serviceConfig = { + Environment = [ + "AREA=Live" + "DATABASE_PATH=${cfg.dataDir}/podcast.db" + ]; + EnvironmentFile = "/run/podcastitlater/worker-env"; + KillSignal = "INT"; + Type = "simple"; + Restart = "always"; + RestartSec = "10"; + }; + }; + }; +} |
