One derivation using two different C++ toolchains?

Hi!
I’m working on a project that involves using two different C++ toolchains for different parts of it.
For the sake of simplicity * let’s suppose that the toolchains in question are clang-17 and clang-18. I’d like to have a single mkShell which lets me use both compilers under different aliases, i.e. clang++-17 and clang++-18.

Here is my unsuccessful attempt to do it:

{
  description = "mypackage";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { nixpkgs, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = import nixpkgs {
          system = system;
        };
        stdenv = pkgs.clang18Stdenv;
      in
      {
        devShells.default = pkgs.mkShell.override { stdenv = stdenv; } {
          packages = [
            pkgs.clang17Stdenv.cc
          ];
        };
      });
}

But this doesn’t work: I don’t seem to have a proper clang-18 in this case; which clang-18 points to bare compiler (instead of nix wrapper) and therefore it doesn’t function properly. What’s the correct way of doing it?

Note that I of course could just make two separate mkShell’s; but it seems like having a single dev environment would be much more convenient for development process.

(* In reality, I need one toolchain for native build and another for wasm cross-compilation build, but that’s probably irrelevant).