The way to record bagpipes is far, far away.
Preferably while wearing earplugs.
On a more serious note...
Use a condenser mic, give it a considerable amount of distance (2 to 4 ft.), and start with the trim all the way down and work it up slowly.
Okay... I'm guessing on this... I admit it.
The last time I heard bagpipes on a recording was at the end of the song "Killer Queen" by Queen.