Preheat your oven to 350°F (175°C). Grease and line two 8-inch round cake pans with parchment paper.
In a medium bowl, whisk together the gluten free flour, baking powder, baking soda, cinnamon, nutmeg, and salt.
In a large bowl, beat the granulated sugar, brown sugar, and oil until well combined. Add the eggs one at a time, mixing well after each addition. Stir in the vanilla extract.
Gradually add the dry ingredients into the wet mixture and mix gently until just combined. Fold in the grated carrots and nuts if using. Do not overmix.
Divide the batter evenly between the prepared pans and smooth the tops.
Bake for 30–35 minutes, or until a toothpick inserted into the center comes out clean. Allow the cakes to cool in the pans for 10 minutes before transferring to a wire rack to cool completely.
For the frosting, beat the cream cheese and butter together until smooth and creamy. Gradually add powdered sugar and beat until fluffy. Stir in the vanilla extract.
Once the cakes are completely cool, frost the top of one layer, place the second layer on top, and frost the top and sides evenly.