Unable to build the broadcom-sta drivers required for my wifi card

here is my nixos configuration

The logs:

❯        nix log /nix/store/dr6wck522q3mh97638j35pzd3qifc7sl-broadcom-sta-6.30.223.271-57-6.17.drv
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
Makefile
lib/
lib/wlc_hybrid.o_shipped
lib/LICENSE.txt
src/
src/include/
src/include/typedefs.h
src/include/linuxver.h
src/include/bcmutils.h
src/include/siutils.h
src/include/packed_section_start.h
src/include/epivers.h
src/include/linux_osl.h
src/include/bcmendian.h
src/include/packed_section_end.h
src/include/pcicfg.h
src/include/bcmdefs.h
src/include/bcmcrypto/
src/include/bcmcrypto/tkhash.h
src/include/wlioctl.h
src/include/osl.h
src/shared/
src/shared/bcmwifi/
src/shared/bcmwifi/include/
src/shared/bcmwifi/include/bcmwifi_channels.h
src/shared/bcmwifi/include/bcmwifi_rates.h
src/shared/linux_osl.c
src/wl/
src/wl/sys/
src/wl/sys/wl_dbg.h
src/wl/sys/wlc_key.h
src/wl/sys/wl_linux.h
src/wl/sys/wl_linux.c
src/wl/sys/wlc_wowl.h
src/wl/sys/wl_iw.c
src/wl/sys/wlc_pub.h
src/wl/sys/wl_iw.h
src/wl/sys/wl_export.h
src/wl/sys/wl_cfg80211_hybrid.h
src/wl/sys/wlc_ethereal.h
src/wl/sys/wl_cfg80211_hybrid.c
src/wl/sys/wlc_utils.h
src/wl/sys/wlc_types.h
src/common/
src/common/include/
src/common/include/proto/
src/common/include/proto/bcmeth.h
src/common/include/proto/ieee80211_radiotap.h
src/common/include/proto/ethernet.h
src/common/include/proto/802.1d.h
src/common/include/proto/bcmip.h
src/common/include/proto/bcmevent.h
src/common/include/proto/802.11.h
src/common/include/proto/wpa.h
setting SOURCE_DATE_EPOCH to timestamp 1442616450 of file "broadcom-sta/src/wl/sys/wlc_wowl.h"
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-001_wext_workaround.patch
patching file Makefile
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-002_kernel_3.18_null_pointer.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-003_gcc_4.9_remove_TIME_DATE_macros.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-004_kernel_4.3_rdtscl_to_rdtsc.patch
patching file src/shared/linux_osl.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-005_kernel_4.7_IEEE80211_BAND_to_NL80211_BAND.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-006_gcc_6_fix_indentation_warnings.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-007_kernel_4.8_add_cfg80211_scan_info_struct.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-008_fix_kernel_warnings.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-009_kernel_4.11_remove_last_rx_in_net_device_struct.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-010_kernel_4.12_add_cfg80211_roam_info_struct.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-011_kernel_4.14_new_kernel_read_function_prototype.patch
patching file src/shared/linux_osl.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-012_kernel_4.15_new_timer.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-013_gcc8_fix_bounds_check_warnings.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-014_kernel_read_pos_increment_fix.patch
patching file src/shared/linux_osl.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-015_kernel_5.1_get_ds_removed.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
patching file src/wl/sys/wl_iw.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-016_fix_unsupported_mesh_point.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-017_fix_gcc_fallthrough_warning.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-018_kernel_5.6_adaptations.patch
patching file src/shared/linux_osl.c
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-019_kernel_5.9_segment_eq_removed.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-020_kernel_5.10_get_set_fs_removed.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
patching file src/wl/sys/wlc_pub.h
patching file src/wl/sys/wl_iw.c
patching file src/wl/sys/wl_linux.c
patching file src/wl/sys/wl_linux.h
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-021_kernel_5.17_adaptation.patch
patching file src/wl/sys/wl_iw.h
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-022_kernel_5.18_adaptation.patch
patching file src/shared/linux_osl.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-023_kernel_6.0_adaptation.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-024_kernel_6.1_adaptation.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-025_kernel_6.5_adaptation.patch
patching file src/include/bcmutils.h
patching file src/include/wlioctl.h
patching file src/wl/sys/wl_cfg80211_hybrid.c
patching file src/wl/sys/wl_cfg80211_hybrid.h
patching file src/wl/sys/wl_iw.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-026_kernel_6.10_fix_empty_body_in_if_warning.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-027_wpa_supplicant-2.11_add_max_scan_ie_len.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-028_kernel_6.12_adaptation.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-029_kernel_6.13_adaptation.patch
patching file src/include/linuxver.h
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-030_kernel_6.14_adaptation.patch
patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-031_replace_EXTRA_CFLAGS_EXTRA_LDFLAGS_with_ccflags-y_ldflags-y.patch
patching file Makefile
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-032_add_MODULE_DESCRIPTION_macro.patch
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-033_disable_objtool_add_warning_unmaintained.patch
patching file Makefile
patching file src/wl/sys/wl_linux.c
applying patch /nix/store/8z5ic042mvm77givn0231dzjgj8n4hc9-source/wl-kmod-034_kernel_6.15_adaptation_replace_del_timer_with_timer_delete.patch
patching file src/wl/sys/wl_linux.c
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
no configure script, doing nothing
Running phase: buildPhase
@nix { "action": "setPhase", "phase": "buildPhase" }
build flags: SHELL=/nix/store/cl2gkgnh26mmpka81pc2g5bzjfrili92-bash-5.3p3/bin/bash KBASE=/nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0
KBUILD_NOPEDANTIC=1 make -C /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/build M=`pwd`
make[1]: Entering directory '/nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/build'
make[2]: Entering directory '/build/broadcom-sta'
CFG80211 API is prefered for this kernel version
Using CFG80211 API
  CC [M]  src/shared/linux_osl.o
  CC [M]  src/wl/sys/wl_linux.o
In file included from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/srcu.h:21,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/notifier.h:16,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/arch/x86/include/asm/uprobes.h:13,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/uprobes.h:65,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/mm_types.h:16,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/mmzone.h:22,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/gfp.h:7,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/umh.h:4,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/kmod.h:9,
                 from /nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/module.h:18,
                 from ././src/include/linuxver.h:40,
                 from src/wl/sys/wl_linux.c:27:
src/wl/sys/wl_linux.c: In function 'wl_down':
/nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/include/linux/workqueue.h:772:9: warning: call to '__warn_flushing_systemwide_wq' declared with attribute warning: Please av>
  772 |         __warn_flushing_systemwide_wq();                                \
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wl/sys/wl_linux.c:1505:25: note: in expansion of macro 'flush_scheduled_work'
 1505 |                         flush_scheduled_work();
      |                         ^~~~~~~~~~~~~~~~~~~~
  CC [M]  src/wl/sys/wl_iw.o
  CC [M]  src/wl/sys/wl_cfg80211_hybrid.o
src/wl/sys/wl_cfg80211_hybrid.c:1899:29: error: initialization of 'int (*)(struct wiphy *, int,  u32)' {aka 'int (*)(struct wiphy *, int,  unsigned int)'} from incompatible pointer type 's32 (*)(struct wiphy *>
 1899 |         .set_wiphy_params = wl_cfg80211_set_wiphy_params,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/wl/sys/wl_cfg80211_hybrid.c:1899:29: note: (near initialization for 'wl_cfg80211_ops.set_wiphy_params')
src/wl/sys/wl_cfg80211_hybrid.c:1903:25: error: initialization of 'int (*)(struct wiphy *, struct wireless_dev *, int,  enum nl80211_tx_power_setting,  int)' from incompatible pointer type 's32 (*)(struct wiph>
 1903 |         .set_tx_power = wl_cfg80211_set_tx_power,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~
src/wl/sys/wl_cfg80211_hybrid.c:1903:25: note: (near initialization for 'wl_cfg80211_ops.set_tx_power')
src/wl/sys/wl_cfg80211_hybrid.c:1904:25: error: initialization of 'int (*)(struct wiphy *, struct wireless_dev *, int,  unsigned int,  int *)' from incompatible pointer type 's32 (*)(struct wiphy *, struct wir>
 1904 |         .get_tx_power = wl_cfg80211_get_tx_power,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~
src/wl/sys/wl_cfg80211_hybrid.c:1904:25: note: (near initialization for 'wl_cfg80211_ops.get_tx_power')
make[4]: *** [/nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/scripts/Makefile.build:287: src/wl/sys/wl_cfg80211_hybrid.o] Error 1
make[3]: *** [/nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/Makefile:2011: .] Error 2
make[2]: *** [/nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/Makefile:248: __sub-make] Error 2
make[2]: Leaving directory '/build/broadcom-sta'
make[1]: *** [/nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/source/Makefile:248: __sub-make] Error 2
make[1]: Leaving directory '/nix/store/wymj45wcz689szz7542xzwpi13vpdn7s-linux-6.17-dev/lib/modules/6.17.0/build'
make: *** [Makefile:188: all] Error 2

Using linuxPackages_latest with third-party kernel modules will run into this problem from time to time because external modules don’t update in lock-step with the kernel.

Don’t use the _latest kernel with third-party kernel modules. In fact, sticking to the default LTS kernel is advisable, unless you know a specific reason why a newer kernel is useful for you.

So uhhh, what is the current LTS.

Well actually I went with 6.16 becasue it was working fine before, also its has faster btrfs zstd compression

By default, the latest LTS linux kernel is installed
- Linux kernel - NixOS Wiki

You should be able to unset boot.kernelPackages defined in carbon/default.nix line 27.

Or set it to the default, simply pkgs.linuxPackages
https://search.nixos.org/options?channel=unstable&show=boot.kernelPackages

2 Likes

6.12. It should point to an LTS release by default.