Yeah, nuclear submarines can go a very long time without needing more fuel. Because of that, they can de-salinate water and generate their own oxygen if they need to do so, so that takes care of water and air. That leaves food - with modern preservation methods (including freezers) they can store a whole lot of that in port. A modern nuclear sub can stay down for months no problem, even a year, probably longer.