So, absolutely he can and will make the claim of immunity that attaches to the person of a head of state / head of government while in office. It’s old and broadly recognized customary international law. But it’s not held as absolute; the inviolability of a head of state has not prevailed against allegations of crimes against humanity, or instance.
The Pinochet case in British court is an imperfect but still useful precedent. There’s a fair claim to be made that that’s where western judicial systems began to shift from the absolute inviolability of a head of state.
Against the legal path of trying to argue for piercing this conventional immunity to prosecute domestic U.S. crimes pertaining to drugs and firearms, a cleaner legal case might be to supersede the indictment to focus on alleging international crimes like torture or other crimes against humanity based on how Maduro ran his regime. That could be easier for US federal courts to navigate around sovereign immunity questions. With that said, any alleged crimes from before he was president would not be protected by that immunity, so depending on what’s alleged it may not matter. I’ve not yet read the indictment.