We report on progress towards developing a framework for calculation of the NNLO cross section for top quark pair production. Our approach combines the $q_T$-slicing method and small-$q_T$ factorization, and its main technical challenge comes down to evaluation of the soft function at NNLO. We develop a framework based on sector decomposition and present a proof-of-concept calculation of the $n_f$ part of the NNLO soft function.