Update Checker - Automated Flake Update Notifications

Hey everyone!

I’ve recently created a small systemd service module for NixOS that automatically checks for flake updates and notifies me when changes are available. Thought I’d share it in case it’s useful for others!

What it does:

The module sets up a systemd service and timer that:

  • Checks hourly for NixOS flake updates using nix flake update
  • Skips execution if the flake.lock is already dirty (no conflicting changes)
  • Sends a desktop notification when updates are found
  • Cleans up by restoring the flake.lock so you stay in control of when to actually apply updates
  • Handles errors gracefully with proper logging

How it works:

The service runs with proper environment setup for nix commands and flakes, changes to /etc/nixos, and attempts to update the lock file. If changes are detected, it sends a libnotify notification to the logged-in user. Then it restores the flake.lock, so the updates are only detected, not applied automatically.

Key features:

  • Hourly checks (configurable via systemd timer)
  • Non-invasive (doesn’t modify your actual config)
  • Desktop notifications with proper DBUS/display setup
  • Error handling and logging
  • Persistent timer (runs on boot catch-up if timer fires while system was off)

You can find the full module here if you want to check it out or adapt it for your own system!

Would love to hear if anyone else is using similar approaches or has suggestions for improvement!

1 Like