How can I pass a flag to a distributed package?

Hi! i’m trying to compile a specific version (now unsupported) of GCC, for cross compilation, from this shel.nix file:

let
    pkgs = (import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.05") {}).pkgsCross.armv7l-hf-multiplatform;
in
    pkgs.mkShellNoCC {
        packages = with pkgs; [
            gcc6
        ];
    }

It fails with a warning turned into error:

libtool: compile:  armv7l-unknown-linux-gnueabihf-g++ -O2 -I/nix/store/izlk3rxcwn0mfc6bnvhxp0416nsm810m-glibc-armv7l-unknown-linux-gnueabihf-2.39-52-dev/include -B/nix/store/6p6nx2cn3jgbq2krpmd6k8g5i87lighy-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/ -idirafter /nix/store/izlk3rxcwn0mfc6bnvhxp0416nsm810m-glibc-armv7l-unknown-linux-gnueabihf-2.39-52-dev/include -idirafter /nix/store/8xizvwmq30bfh93hhd1r82yaa9j9bliz-armv7l-unknown-linux-gnueabihf-gcc-7.5.0/lib/gcc/armv7l-unknown-linux-gnueabihf/7.5.0/include-fixed -Wl,-rpath,/nix/store/7xrhlpkm8dcsz9syxq6f958m990k9ymy-gcc-armv7l-unknown-linux-gnueabihf-6.5.0-lib/lib -Wl,-L/nix/store/6p6nx2cn3jgbq2krpmd6k8g5i87lighy-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib -Wl,-rpath -Wl,/nix/store/6p6nx2cn3jgbq2krpmd6k8g5i87lighy-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib -Wl,-dynamic-linker=/nix/store/6p6nx2cn3jgbq2krpmd6k8g5i87lighy-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/ld-linux-armhf.so.3 --sysroot=/ -DHAVE_CONFIG_H -I. -I../../../../gcc-6.5.0/libsanitizer/libbacktrace -I.. -I ../../../../gcc-6.5.0/libsanitizer/../include -I ../../../../gcc-6.5.0/libsanitizer/../libgcc -I ../../libgcc -I .. -I ../../../../gcc-6.5.0/libsanitizer -I ../../../../gcc-6.5.0/libsanitizer/../libbacktrace -W -Wall -Wwrite-strings -Wmissing-format-attribute -Wcast-qual -Werror -Wno-unused-parameter -fno-rtti -fno-exceptions -std=gnu++11 -O2 -I/nix/store/izlk3rxcwn0mfc6bnvhxp0416nsm810m-glibc-armv7l-unknown-linux-gnueabihf-2.39-52-dev/include -B/nix/store/6p6nx2cn3jgbq2krpmd6k8g5i87lighy-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/ -idirafter /nix/store/izlk3rxcwn0mfc6bnvhxp0416nsm810m-glibc-armv7l-unknown-linux-gnueabihf-2.39-52-dev/include -idirafter /nix/store/8xizvwmq30bfh93hhd1r82yaa9j9bliz-armv7l-unknown-linux-gnueabihf-gcc-7.5.0/lib/gcc/armv7l-unknown-linux-gnueabihf/7.5.0/include-fixed -Wl,-rpath,/nix/store/7xrhlpkm8dcsz9syxq6f958m990k9ymy-gcc-armv7l-unknown-linux-gnueabihf-6.5.0-lib/lib -Wl,-L/nix/store/6p6nx2cn3jgbq2krpmd6k8g5i87lighy-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib -Wl,-rpath -Wl,/nix/store/6p6nx2cn3jgbq2krpmd6k8g5i87lighy-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib -Wl,-dynamic-linker=/nix/store/6p6nx2cn3jgbq2krpmd6k8g5i87lighy-glibc-armv7l-unknown-linux-gnueabihf-2.39-52/lib/ld-linux-armhf.so.3 -MT bridge.lo -MD -MP -MF .deps/bridge.Tpo -c ../../../../gcc-6.5.0/libsanitizer/libbacktrace/bridge.cc -o bridge.o >/dev/null 2>&1
../../../../gcc-6.5.0/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c: In function 'd_print_mod':
../../../../gcc-6.5.0/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c:5796:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
       d_append_char (dpi, ' ');
       ^~~~~~~~~~~~~~~~~~~~~~~~
../../../../gcc-6.5.0/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c:5797:5: note: here
     case DEMANGLE_COMPONENT_REFERENCE:
     ^~~~
../../../../gcc-6.5.0/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c:5801:7: error: this statement may fall through [-Werror=implicit-fallthrough=]
       d_append_char (dpi, ' ');
       ^~~~~~~~~~~~~~~~~~~~~~~~
../../../../gcc-6.5.0/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c:5802:5: note: here
     case DEMANGLE_COMPONENT_RVALUE_REFERENCE:
     ^~~~

# [...]

cc1: all warnings being treated as errors
make[4]: *** [Makefile:468: cp-demangle.lo] Error 1
make[4]: Leaving directory '/build/build/armv7l-unknown-linux-gnueabihf/libsanitizer/libbacktrace'
make[3]: *** [Makefile:466: all-recursive] Error 1
make[3]: Leaving directory '/build/build/armv7l-unknown-linux-gnueabihf/libsanitizer'
make[2]: *** [Makefile:336: all] Error 2
make[2]: Leaving directory '/build/build/armv7l-unknown-linux-gnueabihf/libsanitizer'
make[1]: *** [Makefile:10122: all-target-libsanitizer] Error 2
make[1]: Leaving directory '/build/build'
make: *** [Makefile:880: all] Error 2
error: builder for '/nix/store/zm3b90ry1di6g9pgnn6ml5pyqvbdxq52-gcc-armv7l-unknown-linux-gnueabihf-6.5.0.drv' failed with exit code 2

How can i disable the flag -Werror, or how can i pass -Wno-error? i heard overlays may solve the problem, but i’m not sure where should i use them. Thanks!