You can make a legal detachment if all units in that detachment share the same faction keyword. That can be, for example, Chaos or Imperium.
Note however, that to benefit from detachment bonus (like chapter tactics or regimental doctrines), all the units in your detachment must share ALL faction keywords. For example, to have a Death Guard detachment, they must all have Chaos, Heretic Astartes and Death Guard. If you put, say, one GUO in the detachment, it can be a viable Chaos detachment, but not a DG detachment, and none of units, even the DG ones, will be able to benefit from the DG detachment rules.