Setup room cleaning automation
This commit is contained in:
parent
5c5b12cfe6
commit
7df5311859
|
@ -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;
|
||||
})
|
||||
]
|
|
@ -1,7 +1,7 @@
|
|||
{ config, lib, pkgs, inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./matrix.nix ];
|
||||
imports = [ ./matrix.nix ./automation.nix ];
|
||||
# Sops setup for this machine
|
||||
sops.secrets = {
|
||||
"borg-ssh-key" = {
|
||||
|
|
Loading…
Reference in New Issue