The depreciation of mining equipment is a third variable, and it is rather significant at this point in time.
As an example, the Antminer S19 Pro retails for $8-10k and is rated at 3250 W. Running it 24/7/365 would consume 113.88 MWh of electricity over a four-year lifespan. At average marginal hydro power rates ($0.05) this would cost $5,694 while at typical residential rates it would roughly double to $11,388.