diff --git a/secret/hosts/sail.nix b/secret/hosts/sail.nix index 5b9928a..05835dd 100644 Binary files a/secret/hosts/sail.nix and b/secret/hosts/sail.nix differ diff --git a/system/hosts/sail.nix b/system/hosts/sail.nix index 1fe0b80..3285b5e 100644 --- a/system/hosts/sail.nix +++ b/system/hosts/sail.nix @@ -48,6 +48,8 @@ in ../../container/weewx ../../container/matrix ../../container/proxitok + + (import ../nixos/fedifetcher.nix (args // { inherit secret; })) ]; system.stateVersion = "22.11"; diff --git a/system/nixos/fedifetcher.nix b/system/nixos/fedifetcher.nix new file mode 100644 index 0000000..a0d9b5a --- /dev/null +++ b/system/nixos/fedifetcher.nix @@ -0,0 +1,32 @@ +{ config, secret, ... }: + +{ + systemd.services.fedifetcher = { + wants = [ "mastodon-web.service" "mastodon-sidekiq.service" ]; + after = [ "mastodon-web.service" "mastodon-sidekiq.service" ]; + wantedBy = [ "default.target" ]; + + serviceConfig = + let + podman = config.virtualisation.podman.package; + image = "ghcr.io/nanos/fedifetcher:latest"; + data = "/var/lib/fedifetcher:/app/artifacts"; + token = secret.mastodon.fedifetcher.accessToken; + server = "mastodon.kempkens.io"; + in + { + Type = "oneshot"; + ExecStart = "${podman}/bin/podman run -v ${data} --rm ${image} --access-token=${token} --server=${server} --home-timeline-length=50 --max-followings=5 --from-notifications=1"; + }; + }; + + systemd.timers.fedifetcher = { + wantedBy = [ "timers.target" ]; + + timerConfig = { + OnUnitInactiveSec = "15minutes"; + RandomizedDelaySec = 30; + Persistent = true; + }; + }; +}