2 compositing nodes to add some distance fog in Cycles. I unburried the idea from a tutorial by (the famous) Andrew Price. Give attribution to him, if any. I just made a quick scene to show the effect in action.
In the "Map Value" node:
-- Offset: Distance of the fog relative to the camera. (Negative values are in front.)
-- Size: Acts a bit like a density setting.
-- Minimum: Just keep it at zero.
-- Maximum: Limits the effect. (Especially useful for the sky.)
In the "Add" (Color Mix) node:
-- Fac: Map Value. Don't touch. It does all the trick.
-- Image (top): Source image.
-- Image (bottom): Fog color. You're not limited to shades of grey.
Unfortunately, it's not practical to make a node group of this because most of the needed values can't be exposed. Anyway... Enjoy!