How to Create Systemd Services in Nix Home Manager
I recently learnt in home-manager (Nix) you can run systemd services as your own user. This is nice because we don’t need “sudo” permissions to do so. I also prefer to have as much of my config as possible in home-manager, again I don’t need to run “sudo”. Which is probably safer running apps in the least privileged mode. In my case, I wanted to run an attic, a binary cache, watch store command which uploads any changes to /nix/store to my binary cache. Previously I had this running as a systemd service running as root i.e. managed my NixOS. However, I wanted to run the same service, on my non-NixOS machine. So I decided to have a look and see if I could run it in my home-manager config so I could run it the same way across all my machines. Whilst researching I came across the systemd.user.services option which allows us to do exactly this. ...