You need to make this a nixos module file (taking config, and pkgs as inputs, rather than just a derivation to be able to configure nixos modules.
Then you’d want to change buildGoModule to pkgs.buildGoModule.
You don’t manually copy in the store path, you’d instead capture the output of buildGoModule in a variable and then use that in the ExecStart line. (ExecStart = "${my_nm}/bin/nm";)
You can build the package “separately”, but configuring the systemd service is ultimately part of the nixos configuration. You could separate the package definition and the service using it though, and build the package per-emptively as part of CI or whatever.