Heterogenous equilibrium nernst equation
You can mix activity with fugacity in the expression of equilibrium coefficient or reaction quotient. In fact that is quite common when the reaction involves both solution and gas phase reactants/products.

The definition of the equilibrium constant actually involves dividing the standard pressure $p^\unicode{x29b5}=1\,\rm atm$ or the standard concentration $c^\unicode{x29b5}=1\,\rm mol/L$. In your case, the equilibrium constant will be

$$K^\unicode{x29b5}=\frac{[a(\ce{H+})/c^\unicode{x29b5}]^2}{[f(\ce{H2})/p^\unicode{x29b5}]}$$

which is dimensionless, and is related to the change of Gibbs free energy by $\Delta G=\Delta G^\unicode{x29b5}-RT\ln K^\unicode{x29b5}$.