Libc version is different before and after nix-shell -p

I changed my nixos configuration flake from 23.05 to 23.11
nixos 23.11 comes with a new libc version: 2.38

before doing nix-shell -p

 ldd --version
ldd (GNU libc) 2.38
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

after doing nix-shell -p

ldd --version
ldd (GNU libc) 2.37
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

It is quite problematic for me, because I have a project with webgpu that I am using with a specific shell.nix and the driver is not compatible anymore.

nix-shell -p vulkan-tools
vulkaninfo
ERROR: [Loader Message] Code 0 : /nix/store/9v5d40jyvmwgnq1nj8f19ji2rcc5dksd-glibc-2.37-45/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_radeon.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_radeon.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/9v5d40jyvmwgnq1nj8f19ji2rcc5dksd-glibc-2.37-45/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_lvp.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_lvp.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/9v5d40jyvmwgnq1nj8f19ji2rcc5dksd-glibc-2.37-45/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_intel.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_intel.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/9v5d40jyvmwgnq1nj8f19ji2rcc5dksd-glibc-2.37-45/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_virtio.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_virtio.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/9v5d40jyvmwgnq1nj8f19ji2rcc5dksd-glibc-2.37-45/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_intel_hasvk.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_intel_hasvk.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/9v5d40jyvmwgnq1nj8f19ji2rcc5dksd-glibc-2.37-45/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_dzn.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/zwsvcpspvdykjz1i1rpjz7f3msvhpdca-mesa-23.1.9-drivers/lib/libvulkan_dzn.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : vkCreateInstance: Found no drivers!
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /build/source/vulkaninfo/vulkaninfo.h:677:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER

Did I forgot to update something else after sudo nixos-rebuild switch --flake .#my-config ?

 nix-channel --list
nixos https://nixos.org/channels/nixos-23.11

It is confusing for me, because I expect nix-shell to use the current environment with its libc version.

Hey,
maybe try nix-channel --update

–update [names…]
Download the Nix expressions of subscribed channels and create a new generation.
Update all channels if none is specified, and only those included in names other‐
wise.

from the man page

This is a known limitation, you need the newest libc you’re going to use to load first. This means using a driver built against a lower libc (e.g. via nixGL), or pre-loading the newer libc (via LD_PRELOAD), or something of the sort.

Cf. GitHub - nix-community/nixGL: A wrapper tool for nix OpenGL application [maintainer=@guibou], Build against an older libc, keep the newest in the runtime closure · Issue #303405 · NixOS/nixpkgs · GitHub, Help understanding the libGL ABI problem and possible solutions