192 days ago · 6 min read1282 words · Tech · hide · Fediverse post

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…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town