Is it possible to run macOS in a virtual machine on Linux?
Well... if we assume that by 'legally' you mean according to Apple's EULA [there's a lot of bickering about that, so to avoid complication that's the definition I'll use.

Apple's EULA states, in short, that you can only run an Apple OS on Apple hardware; anything else is 'illegal'
see, I had to use that term, didn't I? ;-)

So, of course you could run it in a VM in Linux, but only if your Linux machine was actually a Mac [which would be rather pointless].

They only alternative I'm aware of would be to use a cloud instance &amp; the only one of those I've really heard of [though never used] is MacinCloud
It was discussed on Stack Overflow a few years ago [2012] so that might be worth a look at.