Error when running nixos-generate

I’m trying to build a hyperv vm with nixos-generate with the following command from my macbook. Command works and builds ok when I run it from within nixos.

nixos-generate -f hyperv --flake .#my-machine

But getting the following error.

**error:** a '**x86_64-linux**' with features {} is required to build '**/nix/store/kv45j0ldjyciw9dm8nh318c03wfmly9z-X-Restart-Triggers-sshd.drv**', but I am a '**x86_64-darwin**' with features {**apple-virt, benchmark, big-parallel, nixos-test**}

It would be nice to be able to create my nixos machines from my macbook. Is there a workaround to make this work?

that looks great thanks for sharing this