Nonequilibrium work relation beyond the Boltzmann-Gibbs distribution