TrueNAS in a VM works fine. But you probably want a dedicated HBA card and disks for TrueNAS for PCI passthrough so TrueNAS is able to directly access the real physical drives. TrueNAS uses ZFS and ZFS is quite demanding (lots of RAM, ECC RAM, Enterprise SSDs with PLP, CMR HDDs, lots of CPU...