Sex determination is a key developmental process, yet it is remarkably variable across the tree of life. The dipteran family Sciaridae exhibits one of the most unusual sex determination systems in which mothers control offspring sex through selective elimination of paternal X chromosomes. Whereas in some members of the family females produce mixed-sex broods, others such as the dark-winged fungus gnat Bradysia coprophila are monogenic, with females producing single-sex broods. Female-producing females were previously found to be heterozygous for a large X-linked paracentric inversion (X′), which is maternally inherited and absent from male-producing females. Here, we assembled and characterized the X′ sequence. As close sequence homology between the X and X′ made identification of the inversion challenging, we developed a k-mer-based approach to bin genomic reads before assembly. We confirmed that the inversion spans most of the X′ chromosome (∼55Mb) and encodes ∼3,500 genes. Analysis of the divergence between the inversion and the homologous region of the X revealed that it originated very recently (<0.5Ma). Surprisingly, we found that the X′ is more complex than previously thought and is likely to have undergone multiple rearrangements that have produced regions of varying ages, resembling a supergene composed of evolutionary strata. We found functional degradation of ∼7.3% of genes within the region of recombination suppression, but no evidence of accumulation of repetitive elements. Our findings provide an indication that sex-linked inversions are driving turnover of the strange sex determination system in this family of flies.