runInLinuxVM as non-root user

I have a derivation I need to build in a VM, with checks that cannot be run as root.
So I am trying to create a non-root user to run them:

runInVM = drv: pkgs.vmTools.runInLinuxVM (lib.overrideDerivation drv (attrs: {
  postHook = ''
    ${pkgs.shadow}/bin/useradd testuser 
  '';

  origPostHook = if attrs ? postHook then attrs.postHook else "";

}));

myDrv = runInVM (stdenv.mkDerivation {
  ...
  checkPhase = ''
      su testuser 
      ...
  '';
});

But this fails with su: pam_start: error 26. Has anyone had a similar issue and found a solution?
Or is there a declarative way to set up a VM with a non-root user as the default?