If that datalayer object exists in your page, you can just point the DTM Data Element at it. When you set up your Data Element, you can use JS Object as the Type, and in the Path, you just type datalayer.products
You don't have to use a Data Element here, but you can. When you set your products variable, you can just reference datalayer.products.sku or whatever.
As far as I can tell, right now the only way to set the products variable is through code. There is no interface that allows you to set s.products for DTM UI.
If your code above were run on the global scope, you could set your products variables by simply assigning the s.products variable to a concatenation of pieces from your datalayer object. You would do this in the same way as @jeffchasin mentioned above.
I have set up datalayer.products as a data element. (Lets say I named that element "Products")
I guess what is the best way to set the products variable? Would I have to code it on the site itself, or can I configure the setting of s.products in DTM somehow now the array is saved in a data element?