Bugs don't attack train tracks. Unless that changed since I played last. Solar power for electricity in a fortified mining zone. I have used electric poles surrounded by barriers that weren't attacked either for shorter distances.
In the end you don't really need trains unless you bump the tech cost up a lot and fiddle with the starting resources. I use a tech cost of 5 and slightly bigger and more dense resource areas but make them super rare so I have to use trains.
My problem is bugs attack trains. If I leave a space unguarded it doesn't take long for the bugs to propagate and start attacking the train every time it passes. A few of those and the track breaks from the acid.
You need to park them in a fortified area. The gates will work over train tracks and will open and close when the train needs to go through.
(post is archived)