notifyActive: don't depend on sway

it was a little silly to be shipping sway on headless systems
This commit is contained in:
2024-02-29 17:32:19 +00:00
parent 083f743c1f
commit a3a6278a59

View File

@@ -45,12 +45,14 @@
}; };
system.activationScripts.notifyActive = { system.activationScripts.notifyActive = {
text = '' text = ''
# send a notification to any sway users logged in, that the system has been activated/upgraded. # notify all logged-in users that the system has been activated/upgraded.
# this probably doesn't work if more than one sway session exists on the system. if [ -d /run/user ]; then
_notifyActiveSwaySock="$(echo /run/user/*/sway-ipc*.sock)" for uid in $(ls /run/user); do
if [ -e "$_notifyActiveSwaySock" ]; then PATH="$PATH:${pkgs.sudo}/bin" \
SWAYSOCK="$_notifyActiveSwaySock" ${config.sane.programs.sway.packageUnwrapped}/bin/swaymsg -- exec \ sudo -u "#$uid" env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \
"${pkgs.libnotify}/bin/notify-send 'nixos activated' 'version: $(cat $systemConfig/nixos-version)'" PATH="$PATH:${pkgs.libnotify}/bin" \
notify-send 'nixos activated' "version: $(cat "$systemConfig/nixos-version")"
done
fi fi
''; '';
}; };