No description
  • Rust 89.5%
  • Nix 10%
  • Dockerfile 0.5%
Find a file
goeranh 59659bcd51
All checks were successful
Build and Publish Docker Image / build-docker (push) Successful in 49s
fix docker compose file
2026-04-04 22:17:53 +02:00
.forgejo/workflows action testing 2026-04-04 21:36:59 +02:00
src fix docker compose file 2026-04-04 22:17:53 +02:00
.dockerignore provide a docker image 2026-04-04 17:34:05 +02:00
.gitignore ignore nix build results 2026-04-04 18:07:37 +02:00
Cargo.lock provide a docker image 2026-04-04 17:34:05 +02:00
Cargo.toml provide a docker image 2026-04-04 17:34:05 +02:00
config.daemon.example.toml provide a docker image 2026-04-04 17:34:05 +02:00
config.example.toml time zone import setting 2026-04-01 13:23:24 +02:00
docker-compose.yml provide a docker image 2026-04-04 17:34:05 +02:00
Dockerfile fix docker compose file 2026-04-04 22:17:53 +02:00
flake.lock ical sync test 2026-04-01 11:10:40 +02:00
flake.nix update meta info 2026-04-04 17:58:56 +02:00
README.md fix readme link 2026-04-04 18:40:27 +02:00

Planbot

A Rust CLI tool that syncs dhsn schedule events from planlos.dd.dhsn.de to Nextcloud calendars via CalDAV. Scrapes iCal links from HTML pages, fetches events, and keeps your calendar up-to-date with intelligent sync logic.

How It Works

Planbot scrapes an HTML page to find an iCal download link, fetches the calendar events, and syncs them to a Nextcloud calendar via CalDAV. It tracks event state using content hashes to detect changes between runs, minimizing unnecessary updates and duplicate events.

The sync algorithm compares events by their UID: new events are added, modified events are updated (based on content hash), and removed events are optionally deleted from your calendar. Events are filtered to include only future occurrences starting from today.

For week-based calendars (URLs with ?woche= parameter), planbot automatically fetches multiple weeks ahead, deduplicating events and stopping after detecting two consecutive empty weeks or reaching the maximum fetch limit.

Operation Modes

One-shot Mode (default): Run once and exit, perfect for cron jobs or systemd timers. Configure your schedule source and target calendar, then run manually or via scheduled tasks.

Daemon Mode: Continuous operation with configurable sync intervals. Ideal for Docker containers and Kubernetes deployments. Handles graceful shutdown and continues running after transient errors.

NixOS Integration: Native NixOS module with systemd service/timer, security hardening, credential management, and automatic firewall configuration. Supports both oneshot and daemon modes.

Quick Start

# Build and run
cargo build --release
./target/release/planbot --config config.toml

# Or with Nix
nix run . -- --config config.toml

# List available calendars
planbot --list-calendars

# Preview changes without modifying calendar
planbot --dry-run

Configuration

See config.example.toml for one-shot/cron mode and config.daemon.example.toml for daemon mode. Store your CalDAV password in the PLANBOT_TARGET_PASSWORD environment variable instead of the config file.

Key settings: source HTML and iCal URLs, CalDAV credentials and calendar name, timezone configuration, sync behavior (delete removed events), state file location, and optional daemon/metrics settings.

Docker Deployment

docker build -t planbot .
docker run -v $(pwd)/config.toml:/config/config.toml:ro \
           -e PLANBOT_TARGET_PASSWORD=your-password \
           -p 9090:9090 \
           planbot --config /config/config.toml

Requires daemon mode enabled in config. Optional Prometheus metrics available on port 9090 for monitoring sync operations.

NixOS Module

services.planbot = {
  enable = true;
  configFile = "/etc/planbot/config.toml";
  passwordFile = "/run/secrets/planbot-password";
  interval = "hourly";  # or set daemonMode = true
};

See nixos-examples/ for complete configuration examples.