From 9007fe4d53145e76a631c46fa30dad86d9637515 Mon Sep 17 00:00:00 2001 From: ahuston-0 Date: Tue, 11 Jun 2024 20:55:14 -0400 Subject: [PATCH] move to systemd-timers Signed-off-by: ahuston-0 --- systems/palatine-hill/configuration.nix | 6 ++-- systems/palatine-hill/nextcloud.nix | 37 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 systems/palatine-hill/nextcloud.nix diff --git a/systems/palatine-hill/configuration.nix b/systems/palatine-hill/configuration.nix index 2de6242..e9d9f15 100644 --- a/systems/palatine-hill/configuration.nix +++ b/systems/palatine-hill/configuration.nix @@ -6,10 +6,10 @@ }: { imports = [ - ./cron - ./networking.nix - ./zfs.nix ./hydra.nix + ./networking.nix + ./nextcloud.nix + ./zfs.nix ]; programs.git.lfs.enable = false; diff --git a/systems/palatine-hill/nextcloud.nix b/systems/palatine-hill/nextcloud.nix new file mode 100644 index 0000000..41ac900 --- /dev/null +++ b/systems/palatine-hill/nextcloud.nix @@ -0,0 +1,37 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + systemd.timers."nextcloud-pre-generate" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = 600; + OnUnitActiveSec = 600; + Unit = "nextcloud-pre-generate.service"; + }; + }; + + systemd.services."nextcloud-pre-generate" = { + requires = [ + "docker.service" + "multi-user.target" + ]; + after = [ + "docker.service" + "multi-user.target" + ]; + description = "incrementally pre-generates previews on nextcloud"; + serviceConfig = { + Type = "oneshot"; + DynamicUser = "yes"; + Group = "docker"; + ExecStart = '' + docker ps --format "{{.Names}}" | grep -q "^nextcloud-nextcloud-1$" && docker exec --user www-data nextcloud-nextcloud-1 php occ preview:pre-generate + ''; + }; + }; +}