That sounds a lot like The Night Land by William Hope Hodgson
Wikipedia: The Night Land
The beginning of the book establishes the framework in which a 17th-century gentleman, mourning the death of his beloved, Lady Mirdath, is given a vision of a far-distant future where their souls will be re-united, and sees the world of that time through the eyes of a future incarnation. The language and style used are intended to resemble that of the 17th century, though the prose has features characteristic of no period whatsoever: the almost-complete lack of dialogue and proper names, for example. Critic Ian Bell has suggested that John Milton's epic poem "Paradise Lost" (1667) is probably a partial literary inspiration for Hodgson's novel, especially due to the hellish visions of sombre intensity which mark both works, and other similarities including the use of massive structures (the Temple of Pandemonium in Milton and the Last Redoubt in The Night Land).
Once into the book, the 17th century framing is mostly inconsequential. Instead, the story focuses on the future. The Sun has gone out and the Earth is lit only by the glow of residual vulcanism. The last few millions of the human race are gathered together in a gigantic metal pyramid, nearly eight miles high – the Last Redoubt, under siege from unknown forces and Powers outside in the dark. These are held back by a shield known as the "air clog", powered from a subterranean energy source called the "Earth Current". For millennia, vast living shapes—the Watchers—have waited in the darkness near the pyramid. It is thought they are waiting for the inevitable time when the Circle's power finally weakens and dies. Other living things have been seen in the darkness beyond, some of unknown origins, and others that may once have been human.
....
The diskos is a weapon featuring a razor-sharp spinning disk on a retractable handle. When activated the disk glows and shoots out sparks. This invention may have been inspired by a hand-held children's toy that shoots sparks when a button is pressed to start a small spinning disk. It is also indicated that the diskos develops a special affinity for its owner during training and should not be handled by anyone else. Each diskos is powered from an initial charge taken from the Earth Current. When its owner dies, the Diskos and its charge are returned to the Earth Current.
Ebook on Project Guttenberg.