Preheat your oven to 350°F (175°C). Grease and line the bottoms of two 9-inch cake pans with parchment paper.
In a medium bowl, whisk together flour, cocoa powder, baking powder, baking soda, and salt.
In a large bowl, cream the butter and sugar until light and fluffy (2–3 minutes).
Add eggs one at a time, beating well after each addition. Stir in vanilla extract.
Mix the milk and sour cream together in a small bowl.
Add the dry ingredients to the butter mixture in three parts, alternating with the milk/sour cream mixture (beginning and ending with dry). Mix until just combined, don’t overmix.
Gently stir in the hot coffee or water until the batter is smooth.
Divide the batter evenly between the pans and level the tops.
Bake for 30 minutes, or until a toothpick inserted in the center comes out clean.
Cool cakes in the pans for 10 minutes, then transfer to a wire rack to cool completely.
In a medium bowl, whisk together the egg yolks, evaporated milk, and sugar until well combined.
Melt the butter in a saucepan over medium heat, then slowly whisk in the egg yolk mixture.
Cook over medium heat, stirring constantly, until thickened (about 8–10 minutes). It should coat the back of a spoon.
Remove from heat and stir in vanilla, shredded coconut, and chopped pecans. Let it cool until spreadable.
Place one cake layer on a serving plate and spread half the frosting on top.
Add the second cake layer and spread the remaining frosting over the top.
Let the cake sit for at least 30 minutes before slicing to allow the frosting to set.