Setup room cleaning automation

This commit is contained in:
Nathan McCarty 2023-06-10 20:50:52 -04:00
parent 5c5b12cfe6
commit 7df5311859
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,36 @@
{ 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;
})
]

View File

@ -1,7 +1,7 @@
{ config, lib, pkgs, inputs, ... }: { config, lib, pkgs, inputs, ... }:
{ {
imports = [ ./matrix.nix ]; imports = [ ./matrix.nix ./automation.nix ];
# Sops setup for this machine # Sops setup for this machine
sops.secrets = { sops.secrets = {
"borg-ssh-key" = { "borg-ssh-key" = {