NiRu nanoparticles encapsulated in a nitrogen-doped carbon matrix as a highly efficient electrocatalyst for the hydrogen evolution reaction.