How to change `doCheckByDefault` in a scope in an overlay?

I have an overlay with derivations and doCheckByDefault=false (the default) and would like to enable checking by default for derivations that are in their own scope inside the overlay, but not for those that directly set doCheck in their mkDerivation. I tried different approaches, but none worked so far:

let
  pkgs = import <nixpkgs> {
    overlays = [ overlay ];

    # (1) changes the global default; fetches bash, bootstrap stdenv and many more
    #config.doCheckByDefault = true;
  };

  testdrv = stdenv: name: stdenv.mkDerivation {
    inherit name;
    dontUnpack = true;
    dontConfigure = true;
    dontBuild = true;

    installPhase = ''
      echo "${name}: doCheck=$doCheck"
      mkdir -p $out && touch $out/${name}
    '';
    checkPhase = ''
      echo "%%%%%%% checkPhase executed:  ${name}: doCheck=$doCheck %%%%%%%"
    '';
  };

  testdrvDontCheck = stdenv: name: stdenv.mkDerivation {
    inherit name;
    dontUnpack = true;
    dontConfigure = true;
    dontBuild = true;

    doCheck = false;
    installPhase = ''
      echo "${name}: doCheck=$doCheck"
      mkdir -p $out && touch $out/${name}
    '';
    checkPhase = ''
      echo "%%%%%%% checkPhase executed:  ${name}: doCheck=$doCheck %%%%%%%"
    '';
  };

  overlay = self: super: {
    pkgsWithCheck = self.lib.makeScope self.newScope (self': with self'; {
      a = callPackage ({stdenv}: testdrv stdenv "pkgsWithCheck.a") { };
      b = callPackage ({stdenv}: testdrv stdenv "pkgsWithCheck.b") { };

      c = callPackage ({stdenv}: testdrvDontCheck stdenv "pkgsWithCheck.c") { };

      # (2) this doesn't enable checking by default in the scope
      #config = self.config // { doCheckByDefault = true; };

      # (3) enabled doCheck in the scope, but overrides c.doCheck
      #stdenv = self.addAttrsToDerivation {doCheck=true;} self.stdenv;
    });

    pkgWithoutCheck = self.callPackage ({ stdenv }: testdrv stdenv "pkgWithoutCheck") { };
  };
in { inherit (pkgs) pkgWithoutCheck; } // pkgs.pkgsWithCheck

I would like this result:

  • pkgWithoutCheck.doCheck=false (via the global default doCheckByDefault=false)
  • pkgsWithCheck.a.doCheck=true (new default within the scope)
  • pkgsWithCheck.b.doCheck=true (new default within the scope)
  • pkgsWithCheck.c.doCheck=false (because doCheck=false set in the derivation)

If I uncomment (1), checking is enabled for all derivations by default including pkgWithoutCheck, what I don’t want. Checking is – correctly – not done for pkgsWithCheck.c. Since the global config is changed, many derivations (bash, various stages of stdenv, …) need to be build.

If I uncomment (2), nothing changes: checking is not enabled.

If I uncomment (3), checking is enabled only in the scope, but pkgsWithCheck.c.doCheck is overriden to true, which I don’t want.

I’m out of ideas now… Do I use makeScope or newScope incorrectly?
How can the default config be changed in a scope, but without overriding other preferences set in individual derivations?