These small optical endstops you can buy on ebay. This holder matches the holes on sensors and it is suited for 8mm rail.
I used hot glue for stick to circuit instead of screws, but you can use them...