I am not a nix user myself, but I recently tried to figure out how to get javascript-enabled binaries of GHC without compiling them myself: How can I use GHC's Javascript backend in Github CI
GHCup provides experimental cross-binaries: User Guide - GHCup but currently only for GHC 9.6, hopefully they will provide a binary for the new 9.8.2 release shortly, since only 9.8 has the GHC.JS.Foreign.Callback
module in base which is quite essential. (It only contains pure Haskell code, so you could also just copy-paste it into your own project, but that is the price you pay as an early adopter )