EDIT: READ THIS: https://gist.github.com/felipelalli/6179aac72735fd35ea3a9854beb490e5?permalink_comment_id=5685746#gistcomment-5685746
This guide details the process to resolve the lack of sound from the internal speakers on the Lenovo Legion Pro 7 16IRX9H notebook running NixOS. The issue occurs because the default audio driver (snd_hda_intel) fails to correctly initialize the amplifiers for the Realtek ALC287 codec present in this hardware.
The solution involves applying a specific firmware patch declaratively, leveraging the robustness of NixOS.
Thanks to Felipe "Noksys" Lalli for debugging and documenting the solution in his NixOS configuration repository, noksys/genoc.