mkShell
is a wrapper around stdenv.mkDerivation
. All of the packages you’re seeing are being inherited from stdenv
.
For a more minimal shell, you can use mkShellNoCC
which lacks the c compilers. For an even more minimal shell you can look at https://github.com/numtide/devshell.
I also noticed that if I add e.g. clang_13, nix maintains the link to clang_11. Ideally, these packages do not get installed at all to keep the environment dependencies as limited as possible.
You will want to use clang13Stdenv.mkDerivation
if you’re going to be replacing the C toolchain. You need wrapped versions of the c tools to ensure that it’s able to find the correct libraries, otherwise it will be hard for you to compile and link.