I’m creating backups via the configuration file of nixos.
at the moment only onto the ssd where nixos runs on.
So I would like to know if someone has an example for how to configure it for the situation when it should backup to an external ssd (usb3) accourding to “startat”/systemd.timer and/or automatically when the usb ssd gets connected next time to the pc.
This probably requires that the mountpoint for the ssd is in fstab (that is, declared in the fileSystems nixos options).
Then, the systemd timer will launch borg backup just as before, but systemd will attempt to mount and probably wait for the device before proceeding. After a probably configurable timeout, if the device does not show up, systemd will give up with dependency failed.
it worked with nixos-rebuild switch when the ssd was connected but is not doing automatic backups the next day it is connected.
This is expected. The dependencies only instruct systemd to attempt to mount the ssd when the timer fires. So you have to wait for the next trigger of the timer, that it, midnight.