The paint will stick as long as the brick and mortar (grout) is properly prepared and primed. I recommend using a 100% acrylic universal primer, both Kilz and Zinsser have good products for this project.
The actual prep might involve washing if there is soot from the fireplace. Otherwise, remove any dust with a vacuum and start priming. Any repairs can be done either before or after priming.
Check the following pages for more information;
1) <a href="https://www.house-painting-info.com/painting-interior-brick.html">Painting Interior Brick</a>
2) <a href="https://www.house-painting-info.com/painting-exterior-brick.html">Painting Exterior Brick</a>