Get your taxes done using TurboTax

The roof upgrades and moving other utilities are not allowed.  There was some confusion over roofing upgrades in the previous version of the code that was clarified when it was updated in 2021 (the Inflation Reduction Act, I believe).  Certain roofing system where the structural roof tile also produces electricity are allowed, but improvements to the roof itself that do not generate electricity (whether improvements to the shingles, the decking, or the trusses) are not allowed for the credit.  However, those costs are still additions to your home's cost basis, as may reduce your capital gains when you sell, so keep track.  

https://www.irs.gov/credits-deductions/residential-clean-energy-credit

 

As for the electrical panel, the law itself does not specify, but IRS notice 2013-70 says "

When calculating the § 25D credit, a taxpayer may include the expenditures for labor costs properly allocable to the onsite preparation, assembly, or original installation of the qualified property and for piping or wiring to interconnect the qualifying property to the home."  If the home can't be connected without upgrading the home itself, that seems to qualify, even though the home is not part of the clean energy generating system.