trailblazer: control script updates
This commit is contained in:
parent
0d5ab0315a
commit
5b81ddeca0
2 changed files with 65 additions and 4 deletions
|
@ -34,8 +34,7 @@ let
|
||||||
openrgb -d "Corsair Lighting Node Pro" -m direct -z 1 -s 100 -b 100 -c $1
|
openrgb -d "Corsair Lighting Node Pro" -m direct -z 1 -s 100 -b 100 -c $1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
#mqttServer = "fuuka"
|
mqttServer = "192.168.50.124";
|
||||||
mqttServer = "mitsuru";
|
|
||||||
|
|
||||||
commandScript = pkgs.writeScriptBin "trailblazer-command-daemon" ''
|
commandScript = pkgs.writeScriptBin "trailblazer-command-daemon" ''
|
||||||
#!${pkgs.xonsh}/bin/xonsh
|
#!${pkgs.xonsh}/bin/xonsh
|
||||||
|
@ -65,6 +64,16 @@ let
|
||||||
|
|
||||||
print("[I] Everything should be... well, not-shiny, captain!")
|
print("[I] Everything should be... well, not-shiny, captain!")
|
||||||
|
|
||||||
|
elif verb == "power/suspend":
|
||||||
|
print("[I] Got a 'sleep' request. Dozing.")
|
||||||
|
${pkgs.mosquitto}/bin/mosquitto_pub -h ${mqttServer} -t trailblazer/power/status -m sleep
|
||||||
|
systemctl suspend
|
||||||
|
|
||||||
|
elif verb == "power/off":
|
||||||
|
print("[I] Got a 'power off' request. Will I dream?")
|
||||||
|
${pkgs.mosquitto}/bin/mosquitto_pub -h ${mqttServer} -t trailblazer/power/status -m off
|
||||||
|
systemctl suspend
|
||||||
|
|
||||||
elif verb == "monitors/off":
|
elif verb == "monitors/off":
|
||||||
print("[I] Got a 'monitors off' request. Adding DPMS nulls.")
|
print("[I] Got a 'monitors off' request. Adding DPMS nulls.")
|
||||||
|
|
||||||
|
@ -137,7 +146,8 @@ let
|
||||||
print("[I] Trailblazer status service started. Updating every 10s.")
|
print("[I] Trailblazer status service started. Updating every 10s.")
|
||||||
while True:
|
while True:
|
||||||
sleep 10
|
sleep 10
|
||||||
mosquitto_pub -h mitsuru -t trailblazer/monitors/status -m $(cat /sys/class/drm/card1-HDMI-A-1/dpms)
|
${pkgs.mosquitto}/bin/mosquitto_pub -h ${mqttServer} -t trailblazer/monitors/status -m $(cat /sys/class/drm/card1-HDMI-A-1/dpms)
|
||||||
|
${pkgs.mosquitto}/bin/mosquitto_pub -h ${mqttServer} -t trailblazer/power/status -m on
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -177,7 +187,7 @@ in
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"iommu=on"
|
"iommu=on"
|
||||||
"amd_iommu=on"
|
"amd_iommu=on"
|
||||||
#"pcie_acs_override=downstream,multifunction"
|
"xhci_hcd.quirks=270336" # fix random wakeups, maybe?
|
||||||
];
|
];
|
||||||
|
|
||||||
# Enable fingerprint reader.
|
# Enable fingerprint reader.
|
||||||
|
@ -246,6 +256,8 @@ in
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
users.users.deprekated.extraGroups = [ "docker" ];
|
users.users.deprekated.extraGroups = [ "docker" ];
|
||||||
|
|
||||||
|
# Fix XHCI suprious wakeups.
|
||||||
|
|
||||||
#
|
#
|
||||||
# Trailblazer remote service (allows trailblazer things to be controlled via Home Assistant.
|
# Trailblazer remote service (allows trailblazer things to be controlled via Home Assistant.
|
||||||
#
|
#
|
||||||
|
@ -270,6 +282,54 @@ in
|
||||||
script = "${statusScript}/bin/trailblazer-status-daemon";
|
script = "${statusScript}/bin/trailblazer-status-daemon";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services.suspend_notify = {
|
||||||
|
description = "trailblazer sleep notifier";
|
||||||
|
|
||||||
|
# Start once we're online.
|
||||||
|
wantedBy = [ "suspend.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
before = [ "suspend.target" ];
|
||||||
|
|
||||||
|
script = "${pkgs.mosquitto}/bin/mosquitto_pub -h ${mqttServer} -t trailblazer/power/status -m sleep";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.resume_notify = {
|
||||||
|
description = "trailblazer wake notifier";
|
||||||
|
|
||||||
|
# Start once we're online.
|
||||||
|
wantedBy = [ "suspend.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" "suspend.target" ];
|
||||||
|
|
||||||
|
script = "${pkgs.mosquitto}/bin/mosquitto_pub -h ${mqttServer} -t trailblazer/power/status -m on";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.poweroff_notify = {
|
||||||
|
description = "trailblazer shutdown notifier";
|
||||||
|
|
||||||
|
# Start once we're online.
|
||||||
|
wantedBy = [ "shutdown.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
before = [ "shutdown.target" ];
|
||||||
|
|
||||||
|
script = "${pkgs.mosquitto}/bin/mosquitto_pub -h ${mqttServer} -t trailblazer/power/status -m shutdown";
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.poweron_notify = {
|
||||||
|
description = "trailblazer wake notifier";
|
||||||
|
|
||||||
|
# Start once we're online.
|
||||||
|
wantedBy = [ "suspend.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
|
||||||
|
script = "${pkgs.mosquitto}/bin/mosquitto_pub -h ${mqttServer} -t trailblazer/power/status -m on";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Let trailblazer share its GPS with the house devices.
|
# Let trailblazer share its GPS with the house devices.
|
||||||
#
|
#
|
||||||
|
|
|
@ -56,6 +56,7 @@ with pkgs;
|
||||||
# Utils.
|
# Utils.
|
||||||
_1password-cli
|
_1password-cli
|
||||||
age
|
age
|
||||||
|
age-plugin-yubikey
|
||||||
agenix.agenix
|
agenix.agenix
|
||||||
atool
|
atool
|
||||||
bat
|
bat
|
||||||
|
|
Loading…
Add table
Reference in a new issue