Help! how to install gcc static version

i have gcc but when i do gcc -static, it goes:

/nix/store/5pa1282x1sasbwhmnah6bny1g9pc2lj1-binutils-2.46/bin/ld.bfd: cannot find -lc: No such file or directory
/nix/store/5pa1282x1sasbwhmnah6bny1g9pc2lj1-binutils-2.46/bin/ld.bfd: have you installed the static version of the c library ?
collect2: error: ld returned 1 exit status

What do you mean by install? Where are you putting code, and what is the code?

inside environment.systemPackages

Yeah, remove that, it will not work. Use dev shells, one per project:

dev shells are recommended but not the problem in this case, using gcc in a seperate env gives the same error.
The actual fix is also installing the glibc.static package