2023-06-10 20:50:52 -04:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
2023-06-10 20:54:24 -04:00
|
|
|
path = with pkgs; [ jq postgresql_15_jit matrix-synapse-tools.synadm ];
|
2023-06-10 20:50:52 -04:00
|
|
|
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;
|
|
|
|
})
|
|
|
|
]
|