This is my current map:

I've been extremely starved of iron the whole game, and I've recently run out of oil. This means that I've had no choice but to to make mining outposts, which I've connected via several rail lines. The rail system works like a charm, but the large amount of enemy bases means that I'm pretty much always under attack; I need to repair walls and rebuild turrets when they go down. The solution to this is having a logistic bot network at each stop, but you have to continually supply them with turrets, walls, and repair packs. So how do you automatically deliver these supplies to the outpost?
Obviously the solution is to make the train carry your supplies, but if you're not smart about it, you'll fill the whole car up with, for example, just repair packs and have it be useless for actually hauling ore.
So what's the trick? Middle click! You can middle click in the cargo wagon inventory slots to designate that slot for a specific item. The result is this:


Doing it this way make sure that you never have more than one stack of a necessary item in the train, and thus you can still use the cargo wagon mostly for its intended purpose. In my case, I've set my trains up such that they always have repair packs, walls, gates, turrets, and empty/full oil barrels. You can choose whichever items you want.
The main thing to consider when doing it this way is: Whenever you're offloading from a car, use smart inserters. Otherwise you may end up offloading things you didn't mean to offload. I'm sure this is enough information for you guys to start making your designs, but for the sake of completeness, here's how I've set up the train stations:
Loading Ore: You can use regular fast inserters when loading ore, but make sure you use smart inserters to offload. Top right side, I have a station to barrel up oil and send it back to my main base. Top left is offloading of turrets, walls, gates, and repair packs. I have it currently set to keep 20 turrets, 10 gates, and one stack of repair and walls.

Offloading:Same Idea, (except this happens to be the iron station) but offloading. Note that all the inserters removing ore from the train have to be smart inserters set to only move iron ore.
