{ config, pkgs, ... }: let name = "Jinja-Compose"; in { imports = [ ../../modules/snowflake.nix ./syncthing.nix ./notify-change.nix ]; # Update and start Jinja-Compose project # during boot and after every 30 minutes. # To view the log, run # journalctl -b -u Jinja-Compose -f # systemd.timers."${name}" = { wantedBy = [ "timers.target" ]; partOf = [ "${name}.service" ]; timerConfig = { OnBootSec = "0m"; OnUnitInactiveSec = "30m"; AccuracySec = "1m"; RandomizedDelaySec = "1m"; }; }; # TODO: Add shutdown script (./docker-compose down). systemd.services."${name}" = { description = "Update and start ${name} project"; serviceConfig = { Type = "oneshot"; PrivateTmp = true; User = "root"; }; path = with pkgs; [ # The `docker-compose` helper script is written in `bash` (!) bash docker ]; script = '' set -eu -o pipefail /jc-config/docker-compose pull /jc-config/docker-compose up -d --wait ''; }; }