{ config, lib, pkgs, ... }: let path = with pkgs; [ jq postgresql_15 matrix-synapse-tools.synadm ]; environment = { HOME = "/home/nathan"; XDG_CONFIG_DIRS = "/etc/xdg:/home/nathan/.nix-profile/etc/xdg:/etc/profiles/per-user/nathan/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg"; XDG_CONFIG_HOME = "/home/nathan/.config"; }; synapse-script = { name, script, schedule }: { systemd.services."synapse-script-${name}" = { inherit environment; inherit path; inherit script; serviceConfig = { Type = "oneshot"; User = "nathan"; Group = "users"; }; }; systemd.timers."synapse-script-${name}" = { wantedBy = [ "timers.target" ]; partOf = [ "synapse-script-${name}.service" ]; timerConfig = { OnCalendar = schedule; Unit = "synapse-script-${name}.service"; }; }; }; in lib.mkMerge [ (synapse-script { name = "clean-vacant-rooms"; schedule = "23:00"; script = builtins.readFile ../../scripts/matrix/clean-old-rooms.sh; }) ]