I'm trying to understand how the Gell-Mann–Nishijima relation has been derived: \begin{equation} Q = I_3 + \frac{Y}{2} \end{equation} where $Q$ is the electric charge of the quarks, $I_3$ is the isospin quantum number and $Y$ is the hypercharge given by: \begin{equation} Y = B + S \end{equation} where $B$ is the baryon number and $S$ is the strangeness number.
Most books (I have looked at) discuss the Gell-Mann–Nishijima in relation to the approximate global $\mathrm{SU(3)}$ flavour symmetry that is associated with the up-,down- and strange-quark at high enough energies. But I have yet to fully understand the connection between the Gell-Mann–Nishijima and the $\mathrm{SU(3)}$ flavour symmetry.
Can the Gell-Mann–Nishijima relation somehow been derived or has it simply been postulated by noticing the relation between $Q$, $I_3$ and $Y$? If it can be derived, then I would be very grateful if someone can give a brief outline of how it is derived.