A derivation's `drvPath` in the realized contents of another

We’re trying to end up with a derivation’s drvPath in the store:

pkgs.stdenv.mkDerivation {
  name = "drv-path-in-store";
  buildCommand = ''echo ${lib.escapeShellArg self.nixosConfigurations.foo.config.system.build.toplevel.drvPath} > $out'';
}

This seems to result in a derivation that has a bazillion inputDrvs and inputSrcs and takes a super long time to realize. That’s not practical for us.

Is there a practical way to end up with a derivation’s drvPath in the store, please?

builtins.unsafeDiscardStringContext to the rescue!