  We present a nonperturbative derivation of effective valence-shell
Hamiltonians in the framework of the recently developed in-medium similarity
renormalization group (IM-SRG). As a first application, we calculate the
spectra of $p$- and $sd$-shell nuclei, $^6$Li and $^{18}$O, based on evolved
chiral nucleon-nucleon interactions. For $^6$Li, the spectrum is in very good
agreement with ab-initio results. For $^{18}$O, the IM-SRG provides a new
method for the shell model to systematically go beyond effective interaction
techniques based on diagrammatic expansions.
