Farming is also mostly an energy problem. Assuming cheap energy, you can create hydroponics that scale vertically. Highrise farms, and they could consume electricity during off-peak times when it is extremely low cost.
Water is also not a problem, we are surprisingly good at treating water, can even turn saltwater into freshwater given sufficient energy.