We study 2d $mathcal{N}=(0,2)$ supersymmetric quiver gauge theories that describe the low-energy dynamics of D1-branes at Calabi-Yau fourfold (CY$_4$) singularities. On general grounds, the holomorphic sector of these theories---matter content and (classical) superpotential interactions---should be fully captured by the topological $B$-model on the CY$_4$. By studying a number of examples, we confirm this expectation and flesh out the dictionary between B-brane category and supersymmetric quiver: the matter content of the supersymmetric quiver is encoded in morphisms between B-branes (that is, Ext groups of coherent sheaves), while the superpotential interactions are encoded in the $A_infty$ algebra satisfied by the morphisms. This provides us with a derivation of the supersymmetric quiver directly from the CY$_4$ geometry. We also suggest a relation between triality of $mathcal{N}=(0,2)$ gauge theories and certain mutations of exceptional collections of sheaves. 0d $mathcal{N}=1$ supersymmetric quivers, corresponding to D-instantons probing CY$_5$ singularities, can be discussed similarly.