I’m using NixOS on the unstable channel and don’t have gcc installed by default. No matter what GCC package I try and use, I end up with gcc12. See the following shell commands and output:
[stusmall@desktop:~]$ which gcc
which: no gcc in (/run/wrappers/bin:/home/stusmall/.nix-profile/bin:/nix/profile/bin:/home/stusmall/.local/state/nix/profile/bin:/etc/profiles/per-user/stusmall/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin)
[stusmall@desktop:~]$ nix-shell -p gcc12
[nix-shell:~]$ which gcc
/nix/store/sfgnb6rr428bssyrs54d6d0vv2avi95c-gcc-wrapper-12.3.0/bin/gcc
[nix-shell:~]$ gcc --version
gcc (GCC) 12.3.0
Copyright (C) 2022 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.
[nix-shell:~]$ exit
exit
[stusmall@desktop:~]$ nix-shell -p gcc11
[nix-shell:~]$ which gcc
/nix/store/sfgnb6rr428bssyrs54d6d0vv2avi95c-gcc-wrapper-12.3.0/bin/gcc
[nix-shell:~]$ gcc --version
gcc (GCC) 12.3.0
Copyright (C) 2022 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.
Any idea what’s up with this? Is it a bug? Am I misunderstanding the purpose of the gcc11 package?