Desktop notifications are a nice way to be informed immediately about important changes on your system. In a terminal or interactive shell script this is easy enough: trap 'notify-send "π₯"' ERR. But in a non-interactive or restricted context, such as a systemd service, we need more setup for desktop notifications to work. And with more setup comes more chances to mess up, so it would be good to test that this actually works on a real desktop. Enter NixOS tests! Nix makes it easy to write reproducible tests. The tests run in a virtual machine1, so we donβt need to worry about how the host OS is configured. The test framework supports easily starting services and waiting for them to reach a desired state. Tests can run anywhere with a bit of RAM and disk space. At minimum, we need the test to do the following: Create a NixOS VM with some configuration. Start the VM. Run the commands to test the NixOS configuration. The result is pretty simple (annotated and minimised): { pkgs }: letβ¦
No comments yet. Log in to reply on the Fediverse. Comments will appear here.