Muwatta Malik, Book 16, Hadith 28 (USC-MSA)

Yahya related to me from Malik from Hisham ibn Urwa that his father said, "There were two men in Madina, one of whom dug graves with a niche in the side wall for the body, and the other who did not, and they said, 'Whichever one comes first can do the job,' and the one who dug graves with a niche came first and dug the Messenger of Allah's grave, may Allah bless him and grant him peace."

وَحَدَّثَنِي عَنْ مَالِكٍ، عَنْ هِشَامِ بْنِ عُرْوَةَ، عَنْ أَبِيهِ، أَنَّهُ قَالَ كَانَ بِالْمَدِينَةِ رَجُلاَنِ أَحَدُهُمَا يَلْحَدُ وَالآخَرُ لاَ يَلْحَدُ فَقَالُوا أَيُّهُمَا جَاءَ أَوَّلُ عَمِلَ عَمَلَهُ ‏.‏ فَجَاءَ الَّذِي يَلْحَدُ فَلَحَدَ لِرَسُولِ اللَّهِ صلى الله عليه وسلم ‏.‏

sunnah.com

also referenced under: Book 16, Hadith 550 (In-Book)