From 81a83d79897adef688b63c53fcc21313ab232601 Mon Sep 17 00:00:00 2001 From: Jonas Gaffke Date: Sat, 3 Feb 2024 20:48:34 +0100 Subject: [PATCH] strukturbot: move to quitte --- flake.nix | 2 +- modules/struktur-bot.nix | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 modules/struktur-bot.nix diff --git a/flake.nix b/flake.nix index c6f0f94..a7c2aa7 100755 --- a/flake.nix +++ b/flake.nix @@ -91,7 +91,7 @@ ./modules/fsrewsp.nix ./modules/nightline.nix ./modules/decisions.nix - # ./modules/struktur-bot.nix + ./modules/struktur-bot.nix { nixpkgs.overlays = [ self.overlays.default ]; sops.defaultSopsFile = ./secrets/quitte.yaml; diff --git a/modules/struktur-bot.nix b/modules/struktur-bot.nix new file mode 100644 index 0000000..395205b --- /dev/null +++ b/modules/struktur-bot.nix @@ -0,0 +1,32 @@ +{ config, pkgs, ... }: +{ + sops.secrets."strukturbot_env" = { }; + virtualisation.docker.daemon.settings.dns = ["141.30.1.1" "141.76.14.1"]; + virtualisation.oci-containers = { + containers.struktur-bot = { + image = "struktur-bot"; + environmentFiles = [ + config.sops.secrets."strukturbot_env".path + ]; + extraOptions = [ "--network=host" ]; + }; + }; + systemd.timers."overleaf-backup" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "02:22:00"; + Unit = "overleaf-backup.service"; + }; + }; + + systemd.services."overleaf-backup" = { + script = '' + set -eu + ${pkgs.docker}/bin/docker exec struktur-bot python3 backup.py + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + }; + }; +}