Earlier quoted context omitted.
There's a process for fixing nitrogen using electricity as the primary input: https://en.wikipedia.org/wiki/Birkeland%E2%80%93Eyde_process You can also plant nitrogen fixing plants and till them into the soil at the end of the season.
Even better, electrolyze water and run the hydrogen through a standard Haber-Bosch ammonia plant. It's a little more complicated but much more energy efficient. It's been done on an industrial scale in the past with electricity from hydropower.
Makes me think about the flurry of ill directed excitement about a catalyst that with energy supplied electricity could convert water and CO2 to alcohol. One wonders if it wouldn't be possible use a similar catalyst to convert nitrogen and water to nitrate/ammonia.