You should first investigate the proper way of insulating your attic space. This depends on some factors, including the expected winter temperatures in your region.
The attic needs air circulation, so the insulation should NOT block the soffit vents, otherwise, in freezing cold weather, frost will form on the insulation and leak into the house when it melts. A properly insulated roof/attic also minimizes or eliminates the formation of icicles from the eavestroughs.
The roof boards that the shingles are nailed to, are usually about 3/4" to 1" thick, and one or more layers of shingles and a tar paper/protective barrier adds another 3/8".
If you were nailing something into the roof boards from the inside, you'd want to use nails that will penetrate the board by at least 1/2", but no more than 3/4".