does optiboot bootloader work with adruino nano

Its just a '328P chip, yes? So it will be recognized as such and programmed the same.
pins_arduino.h is independent of the bootloader and is brought in when your sketch compiles.
The bootloader is just providing a means for the serial port to talk to the PC.