How does sexual dimorphism arise during development? The molecular control of this process is especially crucial in the gonads, where niches control the behaviour of germline stem cells to generate the right kind of gamete. In Drosophila, the conserved transcription factor Doublesex determines sex-specific differences in gonad development, but many questions about timings and targets have remained unclear. Now, Mark Van Doren and colleagues tackle these problems, building on their previous finding that XX and XY dsx embryos have male-specific niche cell types. Moving to the adult, they find that dsx gonads contain either a male or female gonadal niche in a 1:1 ratio, and these niches can signal to germline stem cells. A single fly can contain both male and female niches, but each gonad is typically all-male or all-female. Gonadal precursors in dsx embryos express both male- and female-specific markers, an intersexual characteristic that can be feminised later in the larvae (a process that involves the adoption of female-specific proliferation). Male and female gonadal niches become irreversibly determined at different stages in development; bab1/2 acts downstream of dsx to promote female niche development. This work thus reveals a remarkable plasticity of the gonadal stem cell niche and a surprisingly permissive role for dsx in sex-appropriate gonad development.