A large number of free-living bacteria of anaerobic environments have the ability to fix nitrogen, including the genus Clostridium. Fewer genera of aerobic bacteria have this ability.
This seems to be standard information online.
Where would anaerobic bacteria get nitrogen gas to fix? Wouldn't conditions that keep out oxygen also keep out any significant amount of nitrogen to replace that being fixed?