Is there a way to determine if the config is used to build a vm?

I want to merge my configuration for the real system and qemu-vm, and dispatch different config according to whether I’m running nixos-rebuild boot|build|switch or nixos-rebuild build-vm. Is there a reliable way to do this?