Glue is actually better than nails unless you are handlaying track (not something for the inept).
Actually, what I use on flextrack is latex acrylic caulk. It dries clear and you have a bit of a chance of being able to pry it up later.
There was an article in Model Railroader about 2 years back on how to use the stuff. I laid about 8 or 9 feet of track in the past couple days using that method.
As for foam thicknesses, let's look at what it looks like:
This is two of the "1 inch" sheets":
This is the "2 inch" sheet:
This is the "2 inch" sheet carved for a creek - I later took the center of the creek down to wood:
This is a single "1 inch" sheet - I'll probably do a bit of sculpting, but it will need to be shallow by necessity: