As the other answer says it's an Asimov short story called Nightfall. I've read it in a collection by the same name ["Nightfall and other stories"](https://en.wikipedia.org/wiki/Nightfall_and_Other_Stories). The twist ending is not quite as simple as it drives people insane. From what I remember essentially they become desperate for light, any light, and end up burning their whole civilization to the ground to create that light.