audio-server: pause mpv in the early morning

This commit is contained in:
Sandro - 2023-05-21 21:24:29 +02:00
parent ebdbc9fc92
commit afe096f373
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 31 additions and 10 deletions

View File

@ -151,18 +151,39 @@
'');
systemd = {
services.bluetooth-agent = lib.mkIf config.hardware.bluetooth.enable {
description = "Allow anyone to pair via Bluetooth";
wantedBy = [ "multi-user.target" ];
requires = [ "bluetooth.target" ];
after = [ "bluetooth.service" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.bluez-tools}/bin/bt-agent -c NoInputNoOutput";
Restart = "on-failure";
RestartSec = 60;
services = {
bluetooth-agent = lib.mkIf config.hardware.bluetooth.enable {
description = "Allow anyone to pair via Bluetooth";
wantedBy = [ "multi-user.target" ];
requires = [ "bluetooth.target" ];
after = [ "bluetooth.service" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.bluez-tools}/bin/bt-agent -c NoInputNoOutput";
Restart = "on-failure";
RestartSec = 60;
};
};
mpv-pause = {
script = ''
echo '{ "command": ["set_property", "pause", true] }' | ${pkgs.socat}/bin/socat - /tmp/mpvsocket
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
};
timers.mpv-pause = {
wantedBy = [ "timers.target" ];
timerConfig = {
Unit = "mpv-pause.service";
OnCalendar = "*-*-* 05:30:00";
};
};
user.services = {
ledfx = {
after = [ "pipewire.target" ];