Undefined reference to `arc4random_buf@GLIBC_2.36'

I have just got rid of our package manager in our c++ project, and instead of implementing another big player (either conan or vcpkgs) I have decided to give nix a try. I’m new to it and seems I got stucked.
I put together the following shell.nix (any best-practice recommendations are welcome):

# This .nix file defines the dependencies for the srt project
{
  pkgs ? import (fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.05.tar.gz";
    sha256 = "sha256:10wn0l08j9lgqcw8177nh2ljrnxdrpri7bp0g7nvrsn9rkawvlbf";
  }) {}
}:

pkgs.stdenvNoCC.mkDerivation rec {
   name = "shell";
   buildInputs = with pkgs; [
      #gstreamer deps
      pcre2.dev
      libunwind.dev
      elfutils
      zstd
      glibc 

      gst_all_1.gstreamer
#      gst_all_1.gstreamer-dev
      gst_all_1.gst-plugins-base
      gst_all_1.gst-plugins-good
      gst_all_1.gst-plugins-bad
      gst_all_1.gst-plugins-ugly
      gst_all_1.gst-libav

      log4cxx
   ];
   nativeBuildInputs = with pkgs; [
      pkg-config
      cmake
   ];
}

However when I compile in this shell, I get the following link-time error:

/usr/bin/ld: /nix/store/r8dlmcy5a93qxdgsvsywbg3s51fwyvwi-expat-2.5.0/lib/libexpat.so.1: undefined reference to `arc4random_buf@GLIBC_2.36'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/srt.dir/build.make:103: srt] Error 1
make[1]: *** [CMakeFiles/Makefile2:228: CMakeFiles/srt.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

The ldd on the libexpat.so.1 shows the following:

ldd /nix/store/r8dlmcy5a93qxdgsvsywbg3s51fwyvwi-expat-2.5.0/lib/libexpat.so.1
	linux-vdso.so.1 (0x00007ffc4816d000)
	libm.so.6 => /nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib/libm.so.6 (0x00007fda29045000)
	libc.so.6 => /nix/store/yaz7pyf0ah88g2v505l38n0f3wg2vzdj-glibc-2.37-8/lib/libc.so.6 (0x00007fda28e5f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fda29152000)

Obviously the versions of glibc do not seem to match (2.36 vs 2.37). Both piece of software (expat and glibc) seems to be the latest nix pkg, and I have no clue why expat is looking for glibc_2.36. What am I doing wrong and how do I fix it?

Don’t use the release tag because that’s frozen from the initial release of 23.05

Use https://github.com/nixos/nixpkgs/archive/32dcb45f66c0487e92db8303a798ebc548cadedc.tar.gz which is the newest nixos-23.05 from https://status.nixos.org/

You’re supposed to use mkShell to create a development shell, if you need it to not have a compiler use (mkShell.override { stdenv = stdenvNoCC; }).
If you need a compiler then don’t use stdenvNoCC because using the system compiler and binutils causes impurities and is possibly the cause of your problem.