It all depends on how "world ending" it is. Many event's could be somewhat local and there is still survivable land someplace. Others could be short term. There could be so much dust and ash in the atmosphere that little sunlight get's through and practically everything dies, but the ash settles to the ground in a few years and the earth can then rejuvenate. If you are in it, most of the time you won't know if it's one of these or if it's long term and world wide.
It's also possible for humans to live in an almost closed system for extended periods of time and it's not really that hard to create one with a little care. It would take a lot of effort to live there, but it could be done. If there are outside sources of air and water that can be purified, food can be grown in enclosed areas. The food is where all the work comes in. Generating enough energy for artificial photosynthesis. (powering grow lights)
Generating the power would be difficult. The scenario led me to believe solar wouldnt be an option. Fuel has a rather short shelf life except for propane and natural gas and generators for those suck large amounts of fuel as I understand it. Diesel is a good option if it is treated and stored correctly. Youd need a lot though. I'd be hesitant of burning wood for a gasifier or steam as that would let the roving bands of cannibals know where you're at. Youd need a lot of spare parts for a generator.