I tried Gnatnix with moderate success. Better than diatomaceous earth at least, but still not 100% effective.
Real treatment requires multiple areas of attack.
1. Keep the area around the grow clean. This means removing fallen fruit from the trees in the back yard. Keeping the kitchen spotless. Not forgetting about that slice of tomato between the stove and the cabinet...
2. Top dress the media, or better yet, cover it and run your drippers beneath.
3. Use yellow sticky traps to help trap adult flies in the grow chamber and monitor their population.
4. Use a root drench product like gnatrol to control larvae.
5. Use a sticky stem product like Tree Tanglefoot to collect young flies as they exit the media.
If you can keep their populations low in the surrounding area, keep them from getting into the media, attack them as adults, young, and as larvae, then you'll have the best chance at fending off an infestation.