Classical molecular dynamics simulations were used to study the nucleation of the crystal phase of the ionic liquid [dmim+][Cl-] from its supercooled liquid phase, both in the bulk and in contact with a graphitic surface of D = 3 nm. By combining the string method in collective variables [Maragliano et al., J. Chem. Phys. 125, 024106 (2006)], with Markovian milestoning with Voronoi tessellations [Maragliano et al., J. Chem. Theory Comput. 5, 2589-2594 (2009)] and order parameters for molecular crystals [Santiso and Trout, J. Chem. Phys. 134, 064109 (2011)], we computed minimum free energy paths, the approximate size of the critical nucleus, the free energy barrier, and the rates involved in these nucleation processes. For homogeneous nucleation, the subcooled liquid phase has to overcome a free energy barrier of ∼85 kcal/mol to form a critical nucleus of size ∼3.6 nm, which then grows into the monoclinic crystal phase. This free energy barrier becomes about 42% smaller (∼49 kcal/mol) when the subcooled liquid phase is in contact with a graphitic disk, and the critical nucleus formed is about 17% smaller (∼3.0 nm) than the one observed for homogeneous nucleation. The crystal formed in the heterogeneous nucleation scenario has a structure that is similar to that of the bulk crystal, with the exception of the layers of ions next to the graphene surface, which have larger local density and the cations lie with their imidazolium rings parallel to the graphitic surface. The critical nucleus forms near the graphene surface separated only by these layers of ions. The heterogeneous nucleation rate (∼4.8 × 1011 cm-3 s-1) is about one order of magnitude faster than the homogeneous rate (∼6.6 × 1010 cm-3 s-1). The computed free energy barriers and nucleation rates are in reasonable agreement with experimental and simulation values obtained for the homogeneous and heterogeneous nucleation of other systems (ice, urea, Lennard-Jones spheres, and oxide glasses).