I managed to automount an external encrypted SSD using fstab, crypttab and the noauto and x-systemd.automount and the disk shows in Nemo.
With the options user and users I can easily use it and unmount it using Nemo.
Let’s say the mountpoint is /media/usb.
Now, how can I achieve automatic detaching when /media/usb is unmounted? (trying to search this online I get flooded by the mounting problem instead so I don’t find anything.)
Whether via Nemo, umount or systemd stop media-usb.mount, the encrypted disk stays attached in /dev/mapper, namely systemd does not automatically stop systemd-cryptsetup@usb.service.
I tried using the option “StopWhenUnneeded=true” for systemd-cryptsetup@usb.service but it does not seem to work, probably because systemd-cryptsetup@usb.service is not directly needed by media-usb.mount but is needed by device-mapper-usb.device which is the actual one needed by media-usb.mount and has no unit file.