Not an expert in TypeScript, Nix nor Node packaging in Nix so I’d doubt this is production ready if that’s what you’re looking for, but I threw together an example which seems to work. Let me know if you see any potential improvements.
Ah, I see. I’m on NixOS 23.05.589.a558f7ac29f (Stoat) x86_64 and I’ve never built Docker images for macOS so I don’t know how to make that work unfortunately.
You want to use a VM running Linux to build the image, or a dockercontainer running Linux (which on MacOSs runs in a VM).
If you build the image on Mac directly, you’ll end up with an image that says in its metadata that it was “Linux”, but it’s binaries will be “macho” rather than “ELF”.