Starting from an integrable rank- n n vertex model, we construct an explicit family of partition functions indexed by compositions μ = ( μ 1 , … , μ n ) \mu = (\mu _1,\dots ,\mu _n) . Using the Yang–Baxter algebra of the model and a certain rotation operation that acts on our partition functions, we show that they are eigenfunctions of the Cherednik–Dunkl operators Y i Y_i for all 1 ⩽ i ⩽ n 1 \leqslant i \leqslant n , and are thus equal to nonsymmetric Macdonald polynomials E μ E_{\mu } . Our partition functions have the combinatorial interpretation of ensembles of coloured lattice paths which traverse a cylinder. Applying a simple bijection to such path ensembles, we show how to recover the well-known combinatorial formula for E μ E_{\mu } due to Haglund–Haiman–Loehr.