Nicola Sturgeon is to headline an “eclectic” literary festival along with crime writers Ian Rankin and Val McDermid.