Nix Home Manager module for ActivityWatch

I’m using ActivityWatch on NixOS 23.11 and I noticed that the NixOS module does not define a service to run in background and has limited configurability. I created this Home Manager module to address these issues.

My module includes a systemd service that starts aw-qt (and the standard aw watchers) when the user logs in, and periodically cleans up ActivityWatch log files.

I have been using it for a week now and it seems to work fine, but I’m still pretty new to NixOS and Home Manager, so I’m not sure what’s the best approach to adopt fo sharing this configuration with other people. What do you think? Should I convert this Home Manager module into a nix flake? Or rather add this code to the nix module for ActivityWatch and make a PR? Thanks for any feedback.

PS: the first time systemd launches aw-qt, it fails because it cannot create the system tray, nor it can find any Qt plugin. Then aw-qt is restarted by systemd and works fine: it creates the system tray and is able to find the Qt plugins. I guess this strange behavior is related to this issue: qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. · Issue #960 · ActivityWatch/activitywatch · GitHub. I also tried executing aw-qt --no-gui, and in that case aw-qt does not crash (because it does not try to create the system tray) but find no Qt plugins.

Cross posted in the NixOS forum.