my friend used spray glue as he is a carpet fitter ,
you would be better of lining with 1" polystyrene using no nails then boarding over with 3mm ply then sticking carpet to that.much better finish and no awkward angles etc
the only thing my friend forgot to tell me is to cut the carpet (where the screws go through)before screwing anything to the wood as the carpet catches and the thread pulls out and ruining the carpet
see picture below
