A compound of formula: or a pharmaceutically acceptable salt thereof, wherein: X is CR 1; R 1 is C 1 -C 4 -alkyl; R 2 is hydrogen; R 3 is selected from: C 1 -C 6 alkyl; C 2 -C 6 alkenyl; C 2 -C 6 alkynyl; phenyl; C 3 -C 7 cycloalkyl; a 5- or 6-membered heteroaryl having 1-3 heteroatoms independently selected from N, O and S; a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S; and a C 1 -C 6 alkyl substituted by a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S, wherein each cycloalkyl, phenyl, heteroaryl, and heterocycle in R 3 may be unsubstituted or substituted with 1-3 substituents independently selected from the group consisting of halo, C 1 -C 4 alkyl, C 1 -C 4 haloalkyl, -C R, -SO 2 R, and a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S and optionally substituted with 1-2 substituents independently selected from halo, C 1 -C 4 alkyl, and C 1 -C 4 haloalkyl; and each R is independently selected from the group consisting of hydrogen, C 1 -C 4 alkyl, C 3 -C 7 cycloalkyl, a C 1 -C 3 alkyl substituted by a C 3 -C 7 cycloalkyl, a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S, and a C 1 -C 3 alkyl substituted by a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S, wherein each cycloalkyl and heterocycle in R is optionally substituted with 1-2 substituents independently selected from halo, C 1 -C 4 alkyl, and C 1 -C 4 haloalkyl, wherein when R 3 is heteroalkyl, heteroaryl or heterocycle, the heteroalkyl, heteroaryl or heterocycle is attached to the pyrimidine ring via a carbon atom. X is CR 1; R 1 is C 1 -C 4 -alkyl; R 2 is hydrogen; R 3 is selected from: C 1 -C 6 alkyl; C 2 -C 6 alkenyl; C 2 -C 6 alkynyl; phenyl; C 3 -C 7 cycloalkyl; a 5- or 6-membered heteroaryl having 1-3 heteroatoms independently selected from N, O and S; a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S; and a C 1 -C 6 alkyl substituted by a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S, wherein each cycloalkyl, phenyl, heteroaryl, and heterocycle in R 3 may be unsubstituted or substituted with 1-3 substituents independently selected from the group consisting of halo, C 1 -C 4 alkyl, C 1 -C 4 haloalkyl, -C R, -SO 2 R, and a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S and optionally substituted with 1-2 substituents independently selected from halo, C 1 -C 4 alkyl, and C 1 -C 4 haloalkyl; and each R is independently selected from the group consisting of hydrogen, C 1 -C 4 alkyl, C 3 -C 7 cycloalkyl, a C 1 -C 3 alkyl substituted by a C 3 -C 7 cycloalkyl, a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S, and a C 1 -C 3 alkyl substituted by a 4- to 6-membered heterocycle having 1-2 heteroatoms independently selected from N, O and S, wherein each cycloalkyl and heterocycle in R is optionally substituted with 1-2 substituents independently selected from halo, C 1 -C 4 alkyl, and C 1 -C 4 haloalkyl, wherein when R 3 is heteroalkyl, heteroaryl or heterocycle, the heteroalkyl, heteroaryl or heterocycle is attached to the pyrimidine ring via a carbon atom.