We consider the combination of uplink code-domain non-orthogonal multiple access (NOMA) with massive multiple-input multiple-output (MIMO) and reconfigurable intelligent surfaces (RISs). We assume a setup in which the base station (BS) is capable of forming beams towards the RISs under line-of-sight conditions, and where each RIS is covering a cluster of users. In order to support multi-user transmissions within a cluster, code-domain NOMA via spreading is utilized. We investigate the optimization of the RIS weights such that a large number of users is supported. As it turns out, it is a coupled optimization problem that depends on the detection order under interference cancellation and the applied filtering at the BS. We propose to decouple those variables by using sum-rate optimized weights as the initial solution, allowing us to obtain a decoupled estimate of those variables. Then, in order to determine the final weights, the problem is relaxed into a semidefinite program that can be solved efficiently via convex optimization algorithms. Simulation results show the effectiveness of our approach in improving the detectability of the users.