notifyActive activation script -> apply only to GUI systems

else i get warnings on every servo activation
This commit is contained in:
Colin 2024-03-05 18:46:43 +00:00
parent 4d6d79cc81
commit d5811f142d
2 changed files with 14 additions and 13 deletions

View File

@ -43,19 +43,6 @@
fi
'';
};
system.activationScripts.notifyActive = {
text = ''
# notify all logged-in users that the system has been activated/upgraded.
if [ -d /run/user ]; then
for uid in $(ls /run/user); do
PATH="$PATH:${pkgs.sudo}/bin" \
sudo -u "#$uid" env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \
PATH="$PATH:${pkgs.libnotify}/bin" \
notify-send 'nixos activated' "version: $(cat "$systemConfig/nixos-version")"
done
fi
'';
};
# link debug symbols into /run/current-system/sw/lib/debug
# hopefully picked up by gdb automatically?

View File

@ -190,4 +190,18 @@ in
# upstream nixpkgs forbids setting driSupport32Bit unless specifically x86_64 (so aarch64 isn't allowed)
driSupport32Bit = lib.mkDefault true;
}));
system.activationScripts.notifyActive = lib.mkIf config.sane.programs.guiApps.enabled {
text = ''
# notify all logged-in users that the system has been activated/upgraded.
if [ -d /run/user ]; then
for uid in $(ls /run/user); do
PATH="$PATH:${pkgs.sudo}/bin" \
sudo -u "#$uid" env DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \
PATH="$PATH:${pkgs.libnotify}/bin" \
notify-send 'nixos activated' "version: $(cat "$systemConfig/nixos-version")"
done
fi
'';
};
}