[newbie] how to update system wide packages in a nix-shell

Hello. I am new to nixos and learning how it works. I am developing a c program that uses the library readline. I have a file shell.nix that includes this library. I enter a nix-shell and compile my program. Now I have updated the system packages to use gcc13 (default was gcc 11). I see v 13 if I do gcc --version. But if I enter the shell, I see still v 11. How I am supposed to get gcc updated to v 13 system wide?

It is updated system-wide. I suspect what hasn’t been updated is your user channel. Try nix-channel --update without sudo as well.

If that doesn’t work, check your user channels with nix-channel --list. You might find you’re using an outdated stable version.

it works, thank you!