Nuclear structure functions at small x from inelastic shadowing and diffraction