about summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch4
-rw-r--r--pkgs/os-specific/bsd/freebsd/patches/14.0/libcxxrt-headers.patch11
-rw-r--r--pkgs/os-specific/bsd/freebsd/patches/14.0/localedef.patch158
-rw-r--r--pkgs/os-specific/bsd/freebsd/patches/14.0/tinfo-host-cc.patch15
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/bin.nix92
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix17
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/cp.nix10
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/csu.nix2
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix17
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/iconv.nix12
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix2
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/ldd.nix21
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix2
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libcapsicum.nix1
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libcasper.nix26
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix9
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libdl.nix9
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libedit.nix7
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix29
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libjail.nix5
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libncurses-tinfo.nix15
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libncurses.nix25
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libxo.nix6
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/locale.nix7
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/localedef.nix39
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/locales.nix51
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix23
-rw-r--r--pkgs/os-specific/bsd/lib/install-wrapper.sh1
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix34
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/cksum.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/column.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/common.nix3
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix19
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/config.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/csu.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/dict.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix11
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/genassym.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/gencat.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/getconf.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/getent/package.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/include.nix5
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libarch.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libc.nix7
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libm.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libossaudio.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix9
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/librt.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix7
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix9
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/locale/package.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/make.nix7
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/man.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/misc.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix25
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/mknod.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/mtree.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh10
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/rpcgen.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/source.nix12
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix5
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/tic.nix9
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix2
-rw-r--r--pkgs/os-specific/darwin/macfuse/default.nix4
-rw-r--r--pkgs/os-specific/darwin/noah/default.nix2
-rw-r--r--pkgs/os-specific/darwin/osx-cpu-temp/default.nix2
-rw-r--r--pkgs/os-specific/darwin/raycast/default.nix4
-rw-r--r--pkgs/os-specific/linux/afuse/default.nix2
-rw-r--r--pkgs/os-specific/linux/amdgpu-pro/default.nix222
-rw-r--r--pkgs/os-specific/linux/anbox/default.nix5
-rw-r--r--pkgs/os-specific/linux/apparmor/default.nix6
-rw-r--r--pkgs/os-specific/linux/asus-ec-sensors/default.nix2
-rw-r--r--pkgs/os-specific/linux/asus-wmi-sensors/default.nix2
-rw-r--r--pkgs/os-specific/linux/autofs/default.nix28
-rw-r--r--pkgs/os-specific/linux/ax99100/default.nix2
-rw-r--r--pkgs/os-specific/linux/batman-adv/alfred.nix2
-rw-r--r--pkgs/os-specific/linux/batman-adv/batctl.nix2
-rw-r--r--pkgs/os-specific/linux/batman-adv/default.nix2
-rw-r--r--pkgs/os-specific/linux/batman-adv/version.nix10
-rw-r--r--pkgs/os-specific/linux/bpftools/default.nix2
-rw-r--r--pkgs/os-specific/linux/bpftune/default.nix24
-rw-r--r--pkgs/os-specific/linux/busybox/default.nix4
-rw-r--r--pkgs/os-specific/linux/can-isotp/default.nix2
-rw-r--r--pkgs/os-specific/linux/cpupower/default.nix2
-rw-r--r--pkgs/os-specific/linux/cramfsprogs/default.nix2
-rw-r--r--pkgs/os-specific/linux/criu/default.nix2
-rw-r--r--pkgs/os-specific/linux/cryptsetup/default.nix6
-rw-r--r--pkgs/os-specific/linux/digimend/default.nix2
-rw-r--r--pkgs/os-specific/linux/directvnc/default.nix2
-rw-r--r--pkgs/os-specific/linux/dpdk/default.nix2
-rw-r--r--pkgs/os-specific/linux/dstat/default.nix2
-rw-r--r--pkgs/os-specific/linux/e1000e/default.nix2
-rw-r--r--pkgs/os-specific/linux/ebtables/default.nix2
-rw-r--r--pkgs/os-specific/linux/edac-utils/default.nix2
-rw-r--r--pkgs/os-specific/linux/ell/default.nix4
-rw-r--r--pkgs/os-specific/linux/ethq/default.nix4
-rw-r--r--pkgs/os-specific/linux/eventstat/default.nix2
-rw-r--r--pkgs/os-specific/linux/exfat/default.nix2
-rw-r--r--pkgs/os-specific/linux/facetimehd/default.nix2
-rw-r--r--pkgs/os-specific/linux/fbterm/default.nix2
-rw-r--r--pkgs/os-specific/linux/ffado/default.nix65
-rw-r--r--pkgs/os-specific/linux/ffado/fix-build.patch54
-rw-r--r--pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix10
-rw-r--r--pkgs/os-specific/linux/firmware/raspberrypi/armstubs.nix2
-rw-r--r--pkgs/os-specific/linux/firmware/raspberrypi/default.nix9
-rw-r--r--pkgs/os-specific/linux/firmware/zd1211/default.nix2
-rw-r--r--pkgs/os-specific/linux/forkstat/default.nix2
-rw-r--r--pkgs/os-specific/linux/forktty/default.nix2
-rw-r--r--pkgs/os-specific/linux/framework-laptop-kmod/default.nix2
-rw-r--r--pkgs/os-specific/linux/fswebcam/default.nix2
-rw-r--r--pkgs/os-specific/linux/fwts/default.nix2
-rw-r--r--pkgs/os-specific/linux/g15daemon/default.nix2
-rw-r--r--pkgs/os-specific/linux/gasket/default.nix2
-rw-r--r--pkgs/os-specific/linux/gcadapter-oc-kmod/default.nix2
-rw-r--r--pkgs/os-specific/linux/gobi_loader/default.nix2
-rw-r--r--pkgs/os-specific/linux/gt/default.nix2
-rw-r--r--pkgs/os-specific/linux/hdapsd/default.nix2
-rw-r--r--pkgs/os-specific/linux/health-check/default.nix2
-rw-r--r--pkgs/os-specific/linux/hostapd/default.nix2
-rw-r--r--pkgs/os-specific/linux/hwdata/default.nix4
-rw-r--r--pkgs/os-specific/linux/i7z/default.nix2
-rw-r--r--pkgs/os-specific/linux/i810switch/default.nix2
-rw-r--r--pkgs/os-specific/linux/ifenslave/default.nix2
-rw-r--r--pkgs/os-specific/linux/ima-evm-utils/default.nix2
-rw-r--r--pkgs/os-specific/linux/input-utils/default.nix30
-rw-r--r--pkgs/os-specific/linux/intel-speed-select/default.nix2
-rw-r--r--pkgs/os-specific/linux/iotop/default.nix2
-rw-r--r--pkgs/os-specific/linux/iproute/default.nix9
-rw-r--r--pkgs/os-specific/linux/ipset/default.nix2
-rw-r--r--pkgs/os-specific/linux/iptables/default.nix2
-rw-r--r--pkgs/os-specific/linux/ipu6-drivers/default.nix2
-rw-r--r--pkgs/os-specific/linux/iputils/default.nix2
-rw-r--r--pkgs/os-specific/linux/ipvsadm/default.nix2
-rw-r--r--pkgs/os-specific/linux/ivsc-driver/default.nix2
-rw-r--r--pkgs/os-specific/linux/ixgbevf/default.nix2
-rw-r--r--pkgs/os-specific/linux/jool/cli.nix2
-rw-r--r--pkgs/os-specific/linux/jujuutils/default.nix2
-rw-r--r--pkgs/os-specific/linux/kernel-headers/default.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix21
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix5
-rw-r--r--pkgs/os-specific/linux/kernel/gpio-utils.nix2
-rw-r--r--pkgs/os-specific/linux/kernel/hardened/config.nix19
-rw-r--r--pkgs/os-specific/linux/kernel/kernels-org.json32
-rw-r--r--pkgs/os-specific/linux/kernel/linux-libre.nix5
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rpi.nix36
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rt-5.10.nix7
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rt-5.15.nix7
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rt-5.4.nix1
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rt-6.1.nix7
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rt-6.6.nix7
-rw-r--r--pkgs/os-specific/linux/kernel/manual-config.nix43
-rw-r--r--pkgs/os-specific/linux/kernel/patches.nix16
-rw-r--r--pkgs/os-specific/linux/kernel/rust-1.77-6.8.patch799
-rw-r--r--pkgs/os-specific/linux/kernel/rust-1.77.patch159
-rw-r--r--pkgs/os-specific/linux/kernel/xanmod-kernels.nix17
-rw-r--r--pkgs/os-specific/linux/kernel/zen-kernels.nix9
-rw-r--r--pkgs/os-specific/linux/kexec-tools/default.nix9
-rw-r--r--pkgs/os-specific/linux/kexec-tools/fix-purgatory-llvm-libunwind.patch11
-rw-r--r--pkgs/os-specific/linux/ksmbd-tools/default.nix3
-rw-r--r--pkgs/os-specific/linux/latencytop/default.nix2
-rw-r--r--pkgs/os-specific/linux/libbpf/default.nix4
-rw-r--r--pkgs/os-specific/linux/libpsm2/default.nix2
-rw-r--r--pkgs/os-specific/linux/libvolume_id/default.nix2
-rw-r--r--pkgs/os-specific/linux/lightum/default.nix2
-rw-r--r--pkgs/os-specific/linux/liquidtux/default.nix2
-rw-r--r--pkgs/os-specific/linux/lksctp-tools/default.nix2
-rw-r--r--pkgs/os-specific/linux/lockdep/default.nix2
-rw-r--r--pkgs/os-specific/linux/lsscsi/default.nix2
-rw-r--r--pkgs/os-specific/linux/lvm2/common.nix2
-rw-r--r--pkgs/os-specific/linux/mba6x_bl/default.nix2
-rw-r--r--pkgs/os-specific/linux/mceinject/default.nix2
-rw-r--r--pkgs/os-specific/linux/mdadm/default.nix2
-rw-r--r--pkgs/os-specific/linux/metastore/default.nix2
-rw-r--r--pkgs/os-specific/linux/microcode/iucode-tool.nix2
-rw-r--r--pkgs/os-specific/linux/mingetty/default.nix2
-rw-r--r--pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix2
-rw-r--r--pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix2
-rw-r--r--pkgs/os-specific/linux/msr-tools/default.nix2
-rw-r--r--pkgs/os-specific/linux/mstpd/default.nix2
-rw-r--r--pkgs/os-specific/linux/multipath-tools/default.nix15
-rw-r--r--pkgs/os-specific/linux/netatop/default.nix2
-rw-r--r--pkgs/os-specific/linux/nfs-utils/default.nix2
-rw-r--r--pkgs/os-specific/linux/nsncd/default.nix8
-rw-r--r--pkgs/os-specific/linux/nss_ldap/default.nix2
-rw-r--r--pkgs/os-specific/linux/numactl/default.nix2
-rw-r--r--pkgs/os-specific/linux/nvidiabl/default.nix2
-rw-r--r--pkgs/os-specific/linux/pam_ccreds/default.nix2
-rw-r--r--pkgs/os-specific/linux/pam_mount/default.nix2
-rw-r--r--pkgs/os-specific/linux/paxctl/default.nix2
-rw-r--r--pkgs/os-specific/linux/paxtest/default.nix2
-rw-r--r--pkgs/os-specific/linux/pcmciautils/default.nix2
-rw-r--r--pkgs/os-specific/linux/phc-intel/default.nix2
-rw-r--r--pkgs/os-specific/linux/piper/default.nix2
-rw-r--r--pkgs/os-specific/linux/pm-utils/default.nix2
-rw-r--r--pkgs/os-specific/linux/pmount/default.nix2
-rw-r--r--pkgs/os-specific/linux/policycoreutils/default.nix2
-rw-r--r--pkgs/os-specific/linux/pommed-light/default.nix2
-rw-r--r--pkgs/os-specific/linux/power-calibrate/default.nix2
-rw-r--r--pkgs/os-specific/linux/powerstat/default.nix2
-rw-r--r--pkgs/os-specific/linux/procps-ng/default.nix2
-rw-r--r--pkgs/os-specific/linux/pscircle/default.nix2
-rw-r--r--pkgs/os-specific/linux/r8168/default.nix12
-rw-r--r--pkgs/os-specific/linux/rewritefs/default.nix2
-rw-r--r--pkgs/os-specific/linux/rt-tests/default.nix2
-rw-r--r--pkgs/os-specific/linux/rtl8189es/default.nix4
-rw-r--r--pkgs/os-specific/linux/rtl8189fs/default.nix2
-rw-r--r--pkgs/os-specific/linux/rtl88x2bu/default.nix14
-rw-r--r--pkgs/os-specific/linux/schedtool/default.nix2
-rw-r--r--pkgs/os-specific/linux/sd-switch/default.nix6
-rw-r--r--pkgs/os-specific/linux/selinux-python/default.nix2
-rw-r--r--pkgs/os-specific/linux/selinux-sandbox/default.nix2
-rw-r--r--pkgs/os-specific/linux/semodule-utils/default.nix2
-rw-r--r--pkgs/os-specific/linux/setools/default.nix2
-rw-r--r--pkgs/os-specific/linux/smemstat/default.nix2
-rw-r--r--pkgs/os-specific/linux/sssd/default.nix22
-rw-r--r--pkgs/os-specific/linux/statifier/default.nix2
-rw-r--r--pkgs/os-specific/linux/sydbox/default.nix2
-rw-r--r--pkgs/os-specific/linux/sysdig/default.nix2
-rw-r--r--pkgs/os-specific/linux/sysfsutils/default.nix2
-rw-r--r--pkgs/os-specific/linux/sysklogd/default.nix2
-rw-r--r--pkgs/os-specific/linux/syslinux/default.nix2
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix10
-rw-r--r--pkgs/os-specific/linux/tbs/default.nix2
-rw-r--r--pkgs/os-specific/linux/tiptop/default.nix2
-rw-r--r--pkgs/os-specific/linux/tmon/default.nix2
-rw-r--r--pkgs/os-specific/linux/tp_smapi/default.nix2
-rw-r--r--pkgs/os-specific/linux/trace-cmd/kernelshark.nix6
-rw-r--r--pkgs/os-specific/linux/tuna/default.nix1
-rw-r--r--pkgs/os-specific/linux/tunctl/default.nix2
-rw-r--r--pkgs/os-specific/linux/turbostat/default.nix2
-rw-r--r--pkgs/os-specific/linux/ulogd/default.nix2
-rw-r--r--pkgs/os-specific/linux/undervolt/default.nix2
-rw-r--r--pkgs/os-specific/linux/util-linux/default.nix24
-rw-r--r--pkgs/os-specific/linux/v4l2-relayd/default.nix2
-rw-r--r--pkgs/os-specific/linux/v86d/default.nix2
-rw-r--r--pkgs/os-specific/linux/virtio_vmmci/default.nix2
-rw-r--r--pkgs/os-specific/linux/vmm_clock/default.nix2
-rw-r--r--pkgs/os-specific/linux/wireless-tools/default.nix2
-rw-r--r--pkgs/os-specific/linux/wiringpi/default.nix72
-rw-r--r--pkgs/os-specific/linux/x86_energy_perf_policy/default.nix2
-rw-r--r--pkgs/os-specific/linux/x86info/default.nix2
-rw-r--r--pkgs/os-specific/linux/xone/default.nix2
-rw-r--r--pkgs/os-specific/linux/xsensors/default.nix2
-rw-r--r--pkgs/os-specific/windows/mingw-w64/default.nix2
262 files changed, 2095 insertions, 1002 deletions
diff --git a/pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch b/pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch
index 9bb2bea32ee98..4bc21cf8eb147 100644
--- a/pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch
+++ b/pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch
@@ -2,12 +2,11 @@ diff --git a/tools/build/Makefile b/tools/build/Makefile
 index 948a5f9dfdb..592af84eeae 100644
 --- a/tools/build/Makefile
 +++ b/tools/build/Makefile
-@@ -327,15 +327,15 @@ host-symlinks:
+@@ -327,14 +327,14 @@ host-symlinks:
  # and cross-tools stages. We do this here using mkdir since mtree may not exist
  # yet (this happens if we are crossbuilding from Linux/Mac).
  INSTALLDIR_LIST= \
 -	bin \
--	lib/casper \
 -	lib/geom \
 -	usr/include/casper \
 -	usr/include/private/ucl \
@@ -16,7 +15,6 @@ index 948a5f9dfdb..592af84eeae 100644
 -	usr/libdata/pkgconfig \
 -	usr/libexec
 +	${BINDIR} \
-+	${LIBDIR}/casper \
 +	${LIBDIR}/geom \
 +	${INCLUDEDIR}/casper \
 +	${INCLUDEDIR}/private/ucl \
diff --git a/pkgs/os-specific/bsd/freebsd/patches/14.0/libcxxrt-headers.patch b/pkgs/os-specific/bsd/freebsd/patches/14.0/libcxxrt-headers.patch
new file mode 100644
index 0000000000000..256db9e2d9cf4
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/patches/14.0/libcxxrt-headers.patch
@@ -0,0 +1,11 @@
+--- freebsd/lib/libcxxrt/Makefile	2024-05-30 14:27:42.328086005 -0700
++++ freebsd/lib/libcxxrt/Makefile.mod	2024-05-30 14:27:48.048014581 -0700
+@@ -19,6 +19,8 @@
+ SRCS+=		terminate.cc
+ SRCS+=		typeinfo.cc
+ 
++INCS+=cxxabi.h unwind.h unwind-arm.h unwind-itanium.h
++
+ WARNS?=		0
+ CFLAGS+=	-isystem ${SRCDIR} -nostdinc++
+ CXXSTD?=	c++14
diff --git a/pkgs/os-specific/bsd/freebsd/patches/14.0/localedef.patch b/pkgs/os-specific/bsd/freebsd/patches/14.0/localedef.patch
new file mode 100644
index 0000000000000..73a0341bd3240
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/patches/14.0/localedef.patch
@@ -0,0 +1,158 @@
+diff --git a/include/_ctype.h b/include/_ctype.h
+index 91e6b1d14f6b..a6896b598da3 100644
+--- a/include/_ctype.h
++++ b/include/_ctype.h
+@@ -44,7 +44,7 @@
+ #define	__CTYPE_H_
+ 
+ #include <sys/cdefs.h>
+-#include <sys/_types.h>
++#include <sys/types.h>
+ 
+ #define	_CTYPE_A	0x00000100L		/* Alpha */
+ #define	_CTYPE_C	0x00000200L		/* Control */
+diff --git a/lib/libc/locale/collate.h b/lib/libc/locale/collate.h
+index 2d3723b49f5b..6bbff732b9d7 100644
+--- a/lib/libc/locale/collate.h
++++ b/lib/libc/locale/collate.h
+@@ -36,6 +36,7 @@
+ #ifndef _COLLATE_H_
+ #define	_COLLATE_H_
+ 
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
+ #include <limits.h>
+diff --git a/usr.bin/localedef/charmap.c b/usr.bin/localedef/charmap.c
+index 44b7e3292eae..79c30b7cf372 100644
+--- a/usr.bin/localedef/charmap.c
++++ b/usr.bin/localedef/charmap.c
+@@ -31,6 +31,7 @@
+ /*
+  * CHARMAP file handling for localedef.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
+ #include <sys/tree.h>
+diff --git a/usr.bin/localedef/collate.c b/usr.bin/localedef/collate.c
+index 2a080773a95e..3f0030c638f5 100644
+--- a/usr.bin/localedef/collate.c
++++ b/usr.bin/localedef/collate.c
+@@ -31,6 +31,7 @@
+ /*
+  * LC_COLLATE database generation routines for localedef.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <sys/types.h>
+ #include <sys/tree.h>
+diff --git a/usr.bin/localedef/ctype.c b/usr.bin/localedef/ctype.c
+index ab7b76e57b2d..846c6d6480a8 100644
+--- a/usr.bin/localedef/ctype.c
++++ b/usr.bin/localedef/ctype.c
+@@ -32,6 +32,7 @@
+ /*
+  * LC_CTYPE database generation routines for localedef.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <sys/tree.h>
+ 
+diff --git a/usr.bin/localedef/localedef.c b/usr.bin/localedef/localedef.c
+index 5ff146d6f655..ed69aa1f0c0e 100644
+--- a/usr.bin/localedef/localedef.c
++++ b/usr.bin/localedef/localedef.c
+@@ -32,7 +32,7 @@
+  * POSIX localedef.
+  */
+ #include <sys/cdefs.h>
+-#include <sys/endian.h>
++#include <endian.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ 
+diff --git a/usr.bin/localedef/messages.c b/usr.bin/localedef/messages.c
+index 6b8eb9d684dd..0155821d0e56 100644
+--- a/usr.bin/localedef/messages.c
++++ b/usr.bin/localedef/messages.c
+@@ -31,6 +31,7 @@
+ /*
+  * LC_MESSAGES database generation routines for localedef.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/usr.bin/localedef/monetary.c b/usr.bin/localedef/monetary.c
+index 7a77ac7e256c..7636c4deca1f 100644
+--- a/usr.bin/localedef/monetary.c
++++ b/usr.bin/localedef/monetary.c
+@@ -31,6 +31,7 @@
+ /*
+  * LC_MONETARY database generation routines for localedef.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/usr.bin/localedef/numeric.c b/usr.bin/localedef/numeric.c
+index 5533b7c10e1a..9c47494f815c 100644
+--- a/usr.bin/localedef/numeric.c
++++ b/usr.bin/localedef/numeric.c
+@@ -31,6 +31,7 @@
+ /*
+  * LC_NUMERIC database generation routines for localedef.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/usr.bin/localedef/parser.y b/usr.bin/localedef/parser.y
+index 23b3b54f8a6e..e01330f0152d 100644
+--- a/usr.bin/localedef/parser.y
++++ b/usr.bin/localedef/parser.y
+@@ -33,6 +33,7 @@
+  * POSIX localedef grammar.
+  */
+ 
++#include <stdint.h>
+ #include <wchar.h>
+ #include <stdio.h>
+ #include <limits.h>
+diff --git a/usr.bin/localedef/scanner.c b/usr.bin/localedef/scanner.c
+index c6d45a993f28..b17670ef4b4a 100644
+--- a/usr.bin/localedef/scanner.c
++++ b/usr.bin/localedef/scanner.c
+@@ -32,6 +32,7 @@
+  * This file contains the "scanner", which tokenizes the input files
+  * for localedef for processing by the higher level grammar processor.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/usr.bin/localedef/time.c b/usr.bin/localedef/time.c
+index 7a56e244c921..0e409a742d0a 100644
+--- a/usr.bin/localedef/time.c
++++ b/usr.bin/localedef/time.c
+@@ -31,6 +31,7 @@
+ /*
+  * LC_TIME database generation routines for localedef.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/usr.bin/localedef/wide.c b/usr.bin/localedef/wide.c
+index 062e120e6912..a199cddb198d 100644
+--- a/usr.bin/localedef/wide.c
++++ b/usr.bin/localedef/wide.c
+@@ -34,6 +34,7 @@
+  * to the wide character forms used internally by libc.  Unfortunately,
+  * this approach means that we need a method for each and every encoding.
+  */
++#include <stdint.h>
+ #include <sys/cdefs.h>
+ #include <ctype.h>
+ #include <stdlib.h>
diff --git a/pkgs/os-specific/bsd/freebsd/patches/14.0/tinfo-host-cc.patch b/pkgs/os-specific/bsd/freebsd/patches/14.0/tinfo-host-cc.patch
new file mode 100644
index 0000000000000..6446322a8a0a3
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/patches/14.0/tinfo-host-cc.patch
@@ -0,0 +1,15 @@
+--- a/lib/ncurses/tinfo/Makefile	2023-12-26 23:02:07.827892619 -0800
++++ b/lib/ncurses/tinfo/Makefile	2023-12-26 23:01:24.175546100 -0800
+@@ -282,10 +282,10 @@
+ build-tools: make_hash make_keys
+ 
+ make_keys: make_keys.c names.c ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META}
+-	${CC:N${CCACHE_BIN}} -o $@ ${CFLAGS} ${NCURSES_DIR}/ncurses/tinfo/make_keys.c
++	${CC_HOST:N${CCACHE_BIN}} -o $@ ${CFLAGS} ${NCURSES_DIR}/ncurses/tinfo/make_keys.c
+ 
+ make_hash: make_hash.c hashsize.h ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META}
+-	${CC:N${CCACHE_BIN}} -o $@ ${CFLAGS} -DMAIN_PROGRAM \
++	${CC_HOST:N${CCACHE_BIN}} -o $@ ${CFLAGS} -DMAIN_PROGRAM \
+ 		${NCURSES_DIR}/ncurses/tinfo/make_hash.c
+ .endif
+ .if ${MK_DIRDEPS_BUILD} == "yes" && ${MACHINE} != "host"
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix b/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix
new file mode 100644
index 0000000000000..2b2738ec5794a
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix
@@ -0,0 +1,92 @@
+{
+  mkDerivation,
+  pkgsBuildBuild,
+  libjail,
+  libmd,
+  libnetbsd,
+  libcapsicum,
+  libcasper,
+  libelf,
+  libxo,
+  libncurses-tinfo,
+  libedit,
+  lib,
+  stdenv,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  groff,
+  byacc,
+  gencat,
+}:
+mkDerivation {
+  pname = "bins";
+  path = "bin";
+  extraPaths = [
+    "sys/conf"
+    "sys/sys/param.h"
+    "contrib/sendmail"
+    "contrib/tcsh"
+    "usr.bin/printf"
+    "lib/libsm"
+  ];
+  buildInputs = [
+    libjail
+    libmd
+    libnetbsd
+    libcapsicum
+    libcasper
+    libelf
+    libxo
+    libncurses-tinfo
+    libedit
+  ];
+  nativeBuildInputs = [
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    install
+    tsort
+    lorder
+    mandoc
+    groff
+
+    byacc
+    gencat
+  ];
+
+  MK_TESTS = "no";
+
+  postPatch = ''
+    sed -E -i -e '/#define\tBSD.*/d' $BSDSRCDIR/sys/sys/param.h
+    sed -E -i -e '/^SYMLINKS.*/d' $BSDSRCDIR/bin/*/Makefile
+    sed -E -i -e 's/mktemp -t ka/mktemp -t kaXXXXXX/' $BSDSRCDIR/bin/sh/mkbuiltins $BSDSRCDIR/bin/sh/mktokens
+  '';
+
+  preBuild = ''
+    export NIX_CFLAGS_COMPILE="-I$BSDSRCDIR/sys $NIX_CFLAGS_COMPILE"
+
+    make -C $BSDSRCDIR/lib/libsm $makeFlags
+
+    make -C $BSDSRCDIR/bin/sh $makeFlags "CC=${pkgsBuildBuild.stdenv.cc}/bin/cc" CFLAGS="-D__unused= -D__printf0like\(a,b\)= -D__dead2=" ${
+      lib.optionalString (!stdenv.buildPlatform.isFreeBSD) "MK_PIE=no "
+    }mkbuiltins mksyntax mktokens mknodes
+    make -C $BSDSRCDIR/bin/csh $makeFlags "CC=${pkgsBuildBuild.stdenv.cc}/bin/cc" CFLAGS="-D__unused= -D__printf0like\(a,b\)= -D__dead2= -I$BSDSRCDIR/contrib/tcsh -I." ${
+      lib.optionalString (!stdenv.buildPlatform.isFreeBSD) "MK_PIE=no "
+    }gethost
+  '';
+
+  preInstall = ''
+    makeFlags="$makeFlags ROOTDIR=$out/root"
+  '';
+
+  outputs = [
+    "out"
+    "man"
+    "debug"
+  ];
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix b/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix
index 966489d9aef36..79dab282e3f3f 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix
@@ -1,10 +1,23 @@
 { buildPackages, freebsd-lib }:
 
-# Wrap NetBSD's install
+# Wrap GNU coreutils' install
+# The -l flag causes a symlink instead of a copy to be installed, so
+# it is safe to discard during bootstrap since coreutils does not support it.
+
 buildPackages.writeShellScriptBin "boot-install" (
   freebsd-lib.install-wrapper
   + ''
+    fixed_args=()
+    while [[ ''${#args[0]} > 0 ]]; do
+      case "''${args[0]}" in
+        -l)
+          args=("''${args[@]:2}")
+          continue
+      esac
+      fixed_args+=("''${args[0]}")
+      args=("''${args[@]:1}")
+    done
 
-    ${buildPackages.netbsd.install}/bin/xinstall "''${args[@]}"
+    ${buildPackages.coreutils}/bin/install "''${fixed_args[@]}"
   ''
 )
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/cp.nix b/pkgs/os-specific/bsd/freebsd/pkgs/cp.nix
new file mode 100644
index 0000000000000..3ebfd91a4e153
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/cp.nix
@@ -0,0 +1,10 @@
+{ mkDerivation }:
+mkDerivation {
+  path = "bin/cp";
+
+  extraPaths = [ "sys" ];
+
+  postPatch = ''
+    substituteInPlace $BSDSRCDIR/bin/cp/Makefile --replace 'tests' ""
+  '';
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix b/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix
index 0f74d78b1d13d..020a08c1d01ef 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix
@@ -12,7 +12,7 @@
 }:
 
 mkDerivation {
-  isStatic = true;
+  noLibc = true;
   path = "lib/csu";
   extraPaths = [
     "lib/Makefile.inc"
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix b/pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix
index dc215c18aecb7..09674056d9cd8 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix
@@ -18,6 +18,17 @@ let
     lib.concatMapStringsSep "\n" (path: "/${path}") sortedPaths
   );
 in
-runCommand "${pname}-filtered-src" { nativeBuildInputs = [ pkgsBuildBuild.rsync ]; } ''
-  rsync -a -r --files-from=${filterText} ${source}/ $out
-''
+runCommand "${pname}-filtered-src"
+  {
+    nativeBuildInputs = [
+      (pkgsBuildBuild.rsync.override {
+        enableZstd = false;
+        enableXXHash = false;
+        enableOpenSSL = false;
+        enableLZ4 = false;
+      })
+    ];
+  }
+  ''
+    rsync -a -r --files-from=${filterText} ${source}/ $out
+  ''
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/iconv.nix b/pkgs/os-specific/bsd/freebsd/pkgs/iconv.nix
new file mode 100644
index 0000000000000..9c1ba1835c145
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/iconv.nix
@@ -0,0 +1,12 @@
+{
+  mkDerivation,
+  libcapsicum,
+  libcasper,
+}:
+mkDerivation {
+  path = "usr.bin/iconv";
+  buildInputs = [
+    libcapsicum
+    libcasper
+  ];
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
index 70734226a54f5..a7ceb0cdf384f 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
@@ -7,7 +7,7 @@
 }:
 
 mkDerivation {
-  isStatic = true;
+  noLibc = true;
   path = "include";
 
   extraPaths = [
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/ldd.nix b/pkgs/os-specific/bsd/freebsd/pkgs/ldd.nix
new file mode 100644
index 0000000000000..406e37402b2bb
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/ldd.nix
@@ -0,0 +1,21 @@
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  libelf,
+}:
+mkDerivation {
+  path = "usr.bin/ldd";
+  extraPaths = [
+    "libexec/rtld-elf"
+    "contrib/elftoolchain/libelf"
+  ];
+
+  buildInputs = [ libelf ];
+
+  env = {
+    NIX_CFLAGS_COMPILE = "-D_RTLD_PATH=${lib.getLib stdenv.cc.libc}/libexec/ld-elf.so.1";
+  };
+
+  meta.platforms = lib.platforms.freebsd;
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix
index 8f2cc976463e4..a991e69265823 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix
@@ -21,7 +21,7 @@
 }:
 
 mkDerivation {
-  isStatic = true;
+  noLibc = true;
   pname = "libc";
   path = "lib/libc";
   extraPaths =
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libcapsicum.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libcapsicum.nix
new file mode 100644
index 0000000000000..3cb1560df77aa
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libcapsicum.nix
@@ -0,0 +1 @@
+{ mkDerivation }: mkDerivation { path = "lib/libcapsicum"; }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libcasper.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libcasper.nix
new file mode 100644
index 0000000000000..df27f72bc8cb0
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libcasper.nix
@@ -0,0 +1,26 @@
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  libnv,
+}:
+mkDerivation {
+  path = "lib/libcasper/libcasper";
+  extraPaths = [
+    "lib/Makefile.inc"
+    "lib/libcasper"
+  ];
+  buildInputs = [ libnv ];
+
+  MK_TESTS = "no";
+
+  makeFlags = [
+    "STRIP=-s" # flag to install, not command
+    "CFLAGS=-DWITH_CASPER"
+  ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no";
+
+  postInstall = ''
+    make -C $BSDSRCDIR/lib/libcasper/services $makeFlags CFLAGS="-DWITH_CASPER -I$out/include"
+    make -C $BSDSRCDIR/lib/libcasper/services $makeFlags install
+  '';
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix
index 0640d2292d491..fd5591c0ffb8a 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix
@@ -1,4 +1,4 @@
-{ mkDerivation, ... }:
+{ mkDerivation }:
 # this package is quite different from stock libcxxrt.
 # as of FreeBSD 14.0, it is vendored from APPROXIMATELY libcxxrt
 # 5d8a15823a103bbc27f1bfdcf2b5aa008fab57dd, though the vendoring mechanism is
@@ -8,4 +8,11 @@ mkDerivation {
   pname = "libcxxrt";
   path = "lib/libcxxrt";
   extraPaths = [ "contrib/libcxxrt" ];
+  outputs = [
+    "out"
+    "dev"
+    "debug"
+  ];
+  noLibcxx = true;
+  libName = "cxxrt";
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libdl.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libdl.nix
new file mode 100644
index 0000000000000..2b77a0f716624
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libdl.nix
@@ -0,0 +1,9 @@
+{ mkDerivation, ... }:
+mkDerivation {
+  path = "lib/libdl";
+  extraPaths = [
+    "lib/libc"
+    "libexec/rtld-elf"
+  ];
+  buildInputs = [ ];
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libedit.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libedit.nix
new file mode 100644
index 0000000000000..50b1c9f58333f
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libedit.nix
@@ -0,0 +1,7 @@
+{ mkDerivation, libncurses-tinfo }:
+mkDerivation {
+  path = "lib/libedit";
+  extraPaths = [ "contrib/libedit" ];
+  buildInputs = [ libncurses-tinfo ];
+  MK_TESTS = "no";
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix
new file mode 100644
index 0000000000000..a116aff81f397
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix
@@ -0,0 +1,29 @@
+{
+  mkDerivation,
+  lib,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  m4,
+}:
+mkDerivation {
+  path = "lib/libelf";
+  extraPaths = [
+    "lib/libc"
+    "contrib/elftoolchain"
+    "sys/sys/elf32.h"
+    "sys/sys/elf64.h"
+    "sys/sys/elf_common.h"
+  ];
+  buildInputs = [ ];
+  nativeBuildInputs = [
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    install
+    m4
+  ];
+
+  meta.platforms = lib.platforms.freebsd;
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libjail.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libjail.nix
new file mode 100644
index 0000000000000..9150be559c650
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libjail.nix
@@ -0,0 +1,5 @@
+{ mkDerivation }:
+mkDerivation {
+  path = "lib/libjail";
+  MK_TESTS = "no";
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libncurses-tinfo.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libncurses-tinfo.nix
new file mode 100644
index 0000000000000..f86f78dbc2914
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libncurses-tinfo.nix
@@ -0,0 +1,15 @@
+{ mkDerivation, pkgsBuildBuild }:
+mkDerivation {
+  path = "lib/ncurses/tinfo";
+  extraPaths = [
+    "lib/ncurses"
+    "contrib/ncurses"
+    "lib/Makefile.inc"
+  ];
+  CC_HOST = "${pkgsBuildBuild.stdenv.cc}/bin/cc";
+  MK_TESTS = "no";
+  preBuild = ''
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -D_VA_LIST -D_VA_LIST_DECLARED -Dva_list=__builtin_va_list -D_SIZE_T -D_WCHAR_T"
+    make $makeFlags "CFLAGS=-D_VA_LIST -D_VA_LIST_DECLARED -Dva_list=__builtin_va_list -I$BSDSRCDIR/contrib/ncurses/ncurses -I$BSDSRCDIR/contrib/ncurses/include -I." ncurses_dll.h make_hash make_keys
+  '';
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libncurses.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libncurses.nix
new file mode 100644
index 0000000000000..2dd1ee2fe57de
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libncurses.nix
@@ -0,0 +1,25 @@
+{
+  lib,
+  versionData,
+  mkDerivation,
+  libncurses-tinfo,
+  ...
+}:
+mkDerivation {
+  path = "lib/ncurses/ncurses";
+  extraPaths = [
+    "lib/ncurses"
+    "contrib/ncurses"
+    "lib/Makefile.inc"
+  ];
+  MK_TESTS = "no";
+  preBuild = lib.optionalString (versionData.major == 14) ''
+    make -C ../tinfo $makeFlags curses.h ncurses_dll.h ncurses_def.h
+  '';
+  buildInputs = lib.optionals (versionData.major == 14) [ libncurses-tinfo ];
+
+  # some packages depend on libncursesw.so.8
+  postInstall = ''
+    ln -s $out/lib/libncursesw.so.9 $out/lib/libncursesw.so.8
+  '';
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libxo.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libxo.nix
new file mode 100644
index 0000000000000..a4882ea1970c3
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libxo.nix
@@ -0,0 +1,6 @@
+{ mkDerivation }:
+mkDerivation {
+  path = "lib/libxo";
+  extraPaths = [ "contrib/libxo" ];
+  MK_TESTS = "no";
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/locale.nix b/pkgs/os-specific/bsd/freebsd/pkgs/locale.nix
new file mode 100644
index 0000000000000..b661a7cee853f
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/locale.nix
@@ -0,0 +1,7 @@
+{ mkDerivation, libsbuf }:
+mkDerivation {
+  path = "usr.bin/locale";
+  buildInputs = [ libsbuf ];
+  extraPaths = [ "lib/libc/locale" ];
+  MK_TESTS = "no";
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/localedef.nix b/pkgs/os-specific/bsd/freebsd/pkgs/localedef.nix
new file mode 100644
index 0000000000000..2e4902860c8d9
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/localedef.nix
@@ -0,0 +1,39 @@
+{
+  mkDerivation,
+  lib,
+  stdenv,
+  compat,
+  bsdSetupHook,
+  byacc,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+}:
+mkDerivation (
+  {
+    path = "usr.bin/localedef";
+
+    extraPaths = [
+      "lib/libc/locale"
+      "lib/libc/stdtime"
+    ] ++ lib.optionals (!stdenv.hostPlatform.isFreeBSD) [ "." ];
+
+    nativeBuildInputs = [
+      bsdSetupHook
+      byacc
+      freebsdSetupHook
+      makeMinimal
+      install
+    ];
+
+    buildInputs = [ ];
+
+    preBuild = lib.optionalString (!stdenv.hostPlatform.isFreeBSD) ''
+      export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${compat}/include -D__unused= -D__pure= -Wno-strict-aliasing"
+      export NIX_LDFLAGS="$NIX_LDFLAGS -L${compat}/lib"
+    '';
+
+    MK_TESTS = "no";
+  }
+  // lib.optionalAttrs (!stdenv.hostPlatform.isFreeBSD) { BOOTSTRAPPING = 1; }
+)
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/locales.nix b/pkgs/os-specific/bsd/freebsd/pkgs/locales.nix
new file mode 100644
index 0000000000000..d8d3de93d5ec7
--- /dev/null
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/locales.nix
@@ -0,0 +1,51 @@
+{
+  mkDerivation,
+  lib,
+  symlinkJoin,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  groff,
+  localedef,
+  allLocales ? true,
+  locales ? [ "en_US.UTF-8" ],
+}:
+let
+  build =
+    name: needsLocaledef:
+    mkDerivation {
+      path = "share/${name}";
+
+      extraPaths = lib.optional needsLocaledef "tools/tools/locale/etc/final-maps";
+      nativeBuildInputs = [
+        bsdSetupHook
+        freebsdSetupHook
+        makeMinimal
+        install
+        tsort
+        lorder
+        mandoc
+        groff
+      ] ++ lib.optional needsLocaledef localedef;
+    };
+  directories = {
+    colldef = true;
+    colldef_unicode = true;
+    ctypedef = true;
+    monetdef = false;
+    monetdef_unicode = false;
+    msgdef = false;
+    msgdef_unicode = false;
+    numericdef = false;
+    numericdef_unicode = false;
+    timedef = false;
+  };
+in
+symlinkJoin {
+  name = "freebsd-locales";
+  paths = lib.mapAttrsToList build directories;
+}
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
index be195b3bc6fa5..12f2c9407e3c2 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
@@ -2,6 +2,9 @@
   lib,
   stdenv,
   stdenvNoCC,
+  stdenvNoLibs,
+  overrideCC,
+  buildPackages,
   versionData,
   writeText,
   patches,
@@ -21,7 +24,15 @@
 lib.makeOverridable (
   attrs:
   let
-    stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
+    stdenv' =
+      if attrs.noCC or false then
+        stdenvNoCC
+      else if attrs.noLibc or false then
+        stdenvNoLibs
+      else if attrs.noLibcxx or false then
+        overrideCC stdenv buildPackages.llvmPackages.clangNoLibcxx
+      else
+        stdenv;
   in
   stdenv'.mkDerivation (
     rec {
@@ -128,15 +139,17 @@ lib.makeOverridable (
           splitPatch =
             patchFile:
             let
+              allLines' = lib.strings.splitString "\n" (builtins.readFile patchFile);
+              allLines = builtins.filter (
+                line: !((lib.strings.hasPrefix "diff --git" line) || (lib.strings.hasPrefix "index " line))
+              ) allLines';
               foldFunc =
                 a: b:
-                if (lib.strings.hasPrefix "--- " b) then
+                if ((lib.strings.hasPrefix "--- " b) || (lib.strings.hasPrefix "diff --git " b)) then
                   (a ++ [ [ b ] ])
                 else
                   ((lib.lists.init a) ++ (lib.lists.singleton ((lib.lists.last a) ++ [ b ])));
-              partitionedPatches' = lib.lists.foldl foldFunc [ [ ] ] (
-                lib.strings.splitString "\n" (builtins.readFile patchFile)
-              );
+              partitionedPatches' = lib.lists.foldl foldFunc [ [ ] ] allLines;
               partitionedPatches =
                 if (builtins.length partitionedPatches' > 1) then
                   (lib.lists.drop 1 partitionedPatches')
diff --git a/pkgs/os-specific/bsd/lib/install-wrapper.sh b/pkgs/os-specific/bsd/lib/install-wrapper.sh
index 91a7a2679f209..97a2aaab22c0e 100644
--- a/pkgs/os-specific/bsd/lib/install-wrapper.sh
+++ b/pkgs/os-specific/bsd/lib/install-wrapper.sh
@@ -14,7 +14,6 @@ while (( $# )); do
   case $1 in
     -C) ;;
     -o | -g) shift ;;
-    -s) ;;
     -m | -l)
       # handle next arg so not counted as path arg
       args+=("$1" "$2")
diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix
index e0d03108960c0..5f5ec212f2698 100644
--- a/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/pkgs/os-specific/bsd/netbsd/default.nix
@@ -17,15 +17,7 @@ makeScopeWithSplicing' {
       directory = ./pkgs;
     }
     // {
-
-      fetchNetBSD =
-        path: version: sha256:
-        fetchcvs {
-          cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot";
-          module = "src/${path}";
-          inherit sha256;
-          tag = "netbsd-${lib.replaceStrings [ "." ] [ "-" ] version}-RELEASE";
-        };
+      version = "9.2";
 
       defaultMakeFlags = [
         "MKSOFTFLOAT=${
@@ -151,18 +143,18 @@ makeScopeWithSplicing' {
         inherit (buildPackages.buildPackages) rsync;
       };
 
-      _mainLibcExtraPaths = with self; [
-        common
-        i18n_module.src
-        sys.src
-        ld_elf_so.src
-        libpthread.src
-        libm.src
-        libresolv.src
-        librpcsvc.src
-        libutil.src
-        librt.src
-        libcrypt.src
+      _mainLibcExtraPaths = [
+        "common"
+        "lib/i18n_module"
+        "lib/libcrypt"
+        "lib/libm"
+        "lib/libpthread"
+        "lib/libresolv"
+        "lib/librpcsvc"
+        "lib/librt"
+        "lib/libutil"
+        "libexec/ld.elf_so"
+        "sys"
       ];
 
       libc = self.callPackage ./pkgs/libc.nix {
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/cksum.nix b/pkgs/os-specific/bsd/netbsd/pkgs/cksum.nix
index a2ec387501ae1..a95df55874e42 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/cksum.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/cksum.nix
@@ -2,7 +2,5 @@
 
 mkDerivation {
   path = "usr.bin/cksum";
-  version = "9.2";
-  sha256 = "0msfhgyvh5c2jmc6qjnf12c378dhw32ffsl864qz4rdb2b98rfcq";
   meta.platforms = lib.platforms.netbsd;
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/column.nix b/pkgs/os-specific/bsd/netbsd/pkgs/column.nix
index f3cebfa9ab261..a51369433f6c2 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/column.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/column.nix
@@ -1,7 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "usr.bin/column";
-  version = "9.2";
-  sha256 = "0r6b0hjn5ls3j3sv6chibs44fs32yyk2cg8kh70kb4cwajs4ifyl";
-}
+mkDerivation { path = "usr.bin/column"; }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/common.nix b/pkgs/os-specific/bsd/netbsd/pkgs/common.nix
deleted file mode 100644
index 464fc1c9e0c26..0000000000000
--- a/pkgs/os-specific/bsd/netbsd/pkgs/common.nix
+++ /dev/null
@@ -1,3 +0,0 @@
-{ fetchNetBSD }:
-
-fetchNetBSD "common" "9.2" "1pfylz9r3ap5wnwwbwczbfjb1m5qdyspzbnmxmcdkpzz2zgj64b9"
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
index 4c149e95c1ae6..91a2bb8755c89 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
@@ -14,19 +14,16 @@
   netbsdSetupHook,
   makeMinimal,
   rsync,
-  fetchNetBSD,
   _mainLibcExtraPaths,
+  version,
 }:
 
 mkDerivation (
   let
-    version = "9.2";
     commonDeps = [ zlib ];
   in
   {
     path = "tools/compat";
-    sha256 = "1vsxg7136nlhc72vpa664vs22874xh7ila95nkmsd8crn3z3cyn0";
-    inherit version;
 
     setupHooks = [
       ../../../../../build-support/setup-hooks/role.bash
@@ -133,14 +130,12 @@ mkDerivation (
           --subst-var-by version ${version}
       '';
     extraPaths = [
-      include.src
-      libc.src
-      libutil.src
-      (fetchNetBSD "external/bsd/flex" "9.2" "0h98jpfj7vx5zh7vd7bk6b1hmzgkcb757a8j6d9zgygxxv13v43m")
-      (fetchNetBSD "sys/sys" "9.2" "0zawhw51klaigqqwkx0lzrx3mim2jywrc24cm7c66qsf1im9awgd")
-      (fetchNetBSD "common/include/rpc/types.h" "9.2"
-        "0n2df12mlc3cbc48jxq35yzl1y7ghgpykvy7jnfh898rdhac7m9a"
-      )
+      include.path
+      libc.path
+      libutil.path
+      "external/bsd/flex"
+      "sys/sys"
+      "common/include/rpc/types.h"
     ] ++ libutil.extraPaths ++ _mainLibcExtraPaths;
   }
 )
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/config.nix b/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
index c423f3ca86760..272e9065b29b7 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
@@ -13,8 +13,6 @@
 }:
 mkDerivation {
   path = "usr.bin/config";
-  version = "9.2";
-  sha256 = "1yz3n4hncdkk6kp595fh2q5lg150vpqg8iw2dccydkyw4y3hgsjj";
   env.NIX_CFLAGS_COMPILE = toString [ "-DMAKE_BOOTSTRAP" ];
   nativeBuildInputs = [
     bsdSetupHook
@@ -27,5 +25,5 @@ mkDerivation {
     rsync
   ];
   buildInputs = compatIfNeeded;
-  extraPaths = [ cksum.src ];
+  extraPaths = [ cksum.path ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
index 66443331490f5..a0d7ca419c1c4 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
@@ -22,8 +22,6 @@
 
 mkDerivation {
   path = "lib/csu";
-  version = "9.2";
-  sha256 = "0al5jfazvhlzn9hvmnrbchx4d0gm282hq5gp4xs2zmj9ycmf6d03";
   meta.platforms = lib.platforms.netbsd;
   nativeBuildInputs = [
     bsdSetupHook
@@ -43,7 +41,7 @@ mkDerivation {
   ];
   buildInputs = [ headers ];
   extraPaths = [
-    sys.src
-    ld_elf_so.src
+    sys.path
+    ld_elf_so.path
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/dict.nix b/pkgs/os-specific/bsd/netbsd/pkgs/dict.nix
index 0d7d026dd21d2..8d27f29a75e57 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/dict.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/dict.nix
@@ -3,7 +3,5 @@
 mkDerivation {
   path = "share/dict";
   noCC = true;
-  version = "9.2";
-  sha256 = "0svfc0byk59ri37pyjslv4c4rc7zw396r73mr593i78d39q5g3ad";
   makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/share" ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix
index 7c64658bf2e51..57fc0633b0886 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix
@@ -4,14 +4,11 @@
   netbsdSetupHook,
   rsync,
   compatIfNeeded,
-  fetchNetBSD,
 }:
 
 mkDerivation {
   pname = "fts";
   path = "include/fts.h";
-  sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
-  version = "9.2";
   nativeBuildInputs = [
     bsdSetupHook
     netbsdSetupHook
@@ -19,11 +16,9 @@ mkDerivation {
   ];
   propagatedBuildInputs = compatIfNeeded;
   extraPaths = [
-    (fetchNetBSD "lib/libc/gen/fts.c" "9.2" "1a8hmf26242nmv05ipn3ircxb0jqmmi66rh78kkyi9vjwkfl3qn7")
-    (fetchNetBSD "lib/libc/include/namespace.h" "9.2"
-      "0kksr3pdwdc1cplqf5z12ih4cml6l11lqrz91f7hjjm64y7785kc"
-    )
-    (fetchNetBSD "lib/libc/gen/fts.3" "9.2" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1")
+    "lib/libc/gen/fts.c"
+    "lib/libc/include/namespace.h"
+    "lib/libc/gen/fts.3"
   ];
   skipIncludesPhase = true;
   buildPhase = ''
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/genassym.nix b/pkgs/os-specific/bsd/netbsd/pkgs/genassym.nix
index 7f81a77a02dd2..9eed584b29ae4 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/genassym.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/genassym.nix
@@ -1,7 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "usr.bin/genassym";
-  version = "9.2";
-  sha256 = "1acl1dz5kvh9h5806vkz2ap95rdsz7phmynh5i3x5y7agbki030c";
-}
+mkDerivation { path = "usr.bin/genassym"; }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/gencat.nix b/pkgs/os-specific/bsd/netbsd/pkgs/gencat.nix
index 411be85e91e2f..ea701b6404ecc 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/gencat.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/gencat.nix
@@ -1,7 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "usr.bin/gencat";
-  version = "9.2";
-  sha256 = "0gd463x1hg36bhr7y0xryb5jyxk0z0g7xvy8rgk82nlbnlnsbbwb";
-}
+mkDerivation { path = "usr.bin/gencat"; }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/getconf.nix b/pkgs/os-specific/bsd/netbsd/pkgs/getconf.nix
index c8483d454b877..2feb6495ccf86 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/getconf.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/getconf.nix
@@ -1,7 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "usr.bin/getconf";
-  sha256 = "122vslz4j3h2mfs921nr2s6m078zcj697yrb75rwp2hnw3qz4s8q";
-  version = "9.2";
-}
+mkDerivation { path = "usr.bin/getconf"; }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/getent/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/getent/package.nix
index 7a9acb1e0a9e8..b6a4efad4ac9c 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/getent/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/getent/package.nix
@@ -2,7 +2,5 @@
 
 mkDerivation {
   path = "usr.bin/getent";
-  sha256 = "1qngywcmm0y7nl8h3n8brvkxq4jw63szbci3kc1q6a6ndhycbbvr";
-  version = "9.2";
   patches = [ ./getent.patch ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix b/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix
index c76ada865775e..066d9f236f9bf 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix
@@ -6,8 +6,6 @@
 
 mkDerivation {
   path = "lib/i18n_module";
-  version = "9.2";
-  sha256 = "0w6y5v3binm7gf2kn7y9jja8k18rhnyl55cvvfnfipjqdxvxd9jd";
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ libc.src ];
+  extraPaths = [ libc.path ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
index ec316a63174fd..6df34b96095e7 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
@@ -10,15 +10,12 @@
   rsync,
   nbperf,
   rpcgen,
-  common,
   defaultMakeFlags,
   stdenv,
 }:
 
 mkDerivation {
   path = "include";
-  version = "9.2";
-  sha256 = "0nxnmj4c8s3hb9n3fpcmd0zl3l1nmhivqgi9a35sis943qvpgl9h";
   nativeBuildInputs = [
     bsdSetupHook
     netbsdSetupHook
@@ -46,7 +43,7 @@ mkDerivation {
     makeFlags=''${makeFlags/INCSDIR/INCSDIR0}
   '';
 
-  extraPaths = [ common ];
+  extraPaths = [ "common" ];
   headersOnly = true;
   noCC = true;
   meta.platforms = lib.platforms.netbsd;
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
index 0fc6ca452be0d..2dbec08f15e85 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
@@ -26,11 +26,9 @@ let
 in
 mkDerivation {
   path = "usr.bin/xinstall";
-  version = "9.2";
-  sha256 = "1f6pbz3qv1qcrchdxif8p5lbmnwl8b9nq615hsd3cyl4avd5bfqj";
   extraPaths = [
-    mtree.src
-    make.src
+    mtree.path
+    make.path
   ];
   nativeBuildInputs = [
     bsdSetupHook
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix b/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
index a350e81d32064..7f25ce097ff0d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
@@ -7,8 +7,6 @@
 
 mkDerivation {
   path = "libexec/ld.elf_so";
-  version = "9.2";
-  sha256 = "0ia9mqzdljly0vqfwflm5mzz55k7qsr4rw2bzhivky6k30vgirqa";
   meta.platforms = lib.platforms.netbsd;
   LIBC_PIC = "${libc}/lib/libc_pic.a";
   # Hack to prevent a symlink being installed here for compatibility.
@@ -18,5 +16,5 @@ mkDerivation {
     "BINDIR=$(out)/libexec"
     "CLIBOBJ=${libc}/lib"
   ];
-  extraPaths = [ libc.src ] ++ libc.extraPaths;
+  extraPaths = [ libc.path ] ++ libc.extraPaths;
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libarch.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libarch.nix
index 93ea02f8a17c1..457ea6fa48d91 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libarch.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libarch.nix
@@ -2,7 +2,5 @@
 
 mkDerivation {
   path = "lib/libarch";
-  version = "9.2";
-  sha256 = "6ssenRhuSwp0Jn71ErT0PrEoCJ+cIYRztwdL4QTDZsQ=";
   meta.platforms = lib.platforms.netbsd;
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
index d755e4b6870a1..cf71857776d83 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
@@ -3,7 +3,6 @@
   mkDerivation,
   defaultMakeFlags,
   _mainLibcExtraPaths,
-  fetchNetBSD,
   bsdSetupHook,
   netbsdSetupHook,
   makeMinimal,
@@ -26,13 +25,9 @@
 
 mkDerivation {
   path = "lib/libc";
-  version = "9.2";
-  sha256 = "1y9c13igg0kai07sqvf9cm6yqmd8lhfd8hq3q7biilbgs1l99as3";
   USE_FORT = "yes";
   MKPROFILE = "no";
-  extraPaths = _mainLibcExtraPaths ++ [
-    (fetchNetBSD "external/bsd/jemalloc" "9.2" "0cq704swa0h2yxv4gc79z2lwxibk9k7pxh3q5qfs7axx3jx3n8kb")
-  ];
+  extraPaths = _mainLibcExtraPaths ++ [ "external/bsd/jemalloc" ];
   nativeBuildInputs = [
     bsdSetupHook
     netbsdSetupHook
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix
index c5f9deff589c4..abcb2cfb14fb8 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix
@@ -2,8 +2,6 @@
 
 mkDerivation {
   path = "lib/libcrypt";
-  version = "9.2";
-  sha256 = "0siqan1wdqmmhchh2n8w6a8x1abbff8n4yb6jrqxap3hqn8ay54g";
   SHLIBINSTALLDIR = "$(out)/lib";
   meta.platforms = lib.platforms.netbsd;
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix
index 5072821db9117..8d61bcfdf7d97 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix
@@ -9,8 +9,6 @@
 
 mkDerivation {
   path = "lib/libcurses";
-  version = "9.2";
-  sha256 = "0pd0dggl3w4bv5i5h0s1wrc8hr66n4hkv3zlklarwfdhc692fqal";
   buildInputs = [ libterminfo ];
   env.NIX_CFLAGS_COMPILE = toString (
     [
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix
index ee1e7bf79f964..cb9951cb8cf10 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix
@@ -9,8 +9,6 @@
 
 mkDerivation {
   path = "lib/libedit";
-  version = "9.2";
-  sha256 = "1wqhngraxwqk4jgrf5f18jy195yrp7c06n1gf31pbplq79mg1bcj";
   buildInputs = [
     libterminfo
     libcurses
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
index f36e97f8e6ae0..8a2304cacbca1 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
@@ -6,9 +6,7 @@
 
 mkDerivation {
   path = "lib/libm";
-  version = "9.2";
-  sha256 = "1apwfr26shdmbqqnmg7hxf7bkfxw44ynqnnnghrww9bnhqdnsy92";
   SHLIBINSTALLDIR = "$(out)/lib";
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ sys.src ];
+  extraPaths = [ sys.path ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libossaudio.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libossaudio.nix
index 51bbc216e2046..a74176db68cdf 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libossaudio.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libossaudio.nix
@@ -2,7 +2,5 @@
 
 mkDerivation {
   path = "lib/libossaudio";
-  version = "9.2";
-  sha256 = "16l3bfy6dcwqnklvh3x0ps8ld1y504vf57v9rx8f9adzhb797jh0";
   meta.platforms = lib.platforms.netbsd;
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix
index b0be4a2da723a..69d1ff5accca4 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix
@@ -7,9 +7,7 @@
 mkDerivation {
   pname = "libpci";
   path = "lib/libpci";
-  version = "9.2";
-  sha256 = "+IOEO1Bw3/H3iCp3uk3bwsFZbvCqN5Ciz70irnPl8E8=";
   env.NIX_CFLAGS_COMPILE = toString [ "-I." ];
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ sys.src ];
+  extraPaths = [ sys.path ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix
index d8ea7c553eba3..08c298c0fe5d5 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix
@@ -1,5 +1 @@
-{
-  path = "lib/libpthread";
-  version = "9.2";
-  sha256 = "0mlmc31k509dwfmx5s2x010wxjc44mr6y0cbmk30cfipqh8c962h";
-}
+{ path = "lib/libpthread"; }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix
index 88d392e20b4a8..28665b351f88a 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix
@@ -2,7 +2,6 @@
   lib,
   mkDerivation,
   headers,
-  common,
   libc,
   librt,
   sys,
@@ -18,10 +17,10 @@ mkDerivation (
     buildInputs = [ headers ];
     SHLIBINSTALLDIR = "$(out)/lib";
     extraPaths = [
-      common
-      libc.src
-      librt.src
-      sys.src
+      "common"
+      libc.path
+      librt.path
+      sys.path
     ];
     meta.platforms = lib.platforms.netbsd;
   }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix
index 24bc4f2f9e002..7db4948e6939b 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix
@@ -6,8 +6,6 @@
 
 mkDerivation {
   path = "lib/libresolv";
-  version = "9.2";
-  sha256 = "1am74s74mf1ynwz3p4ncjkg63f78a1zjm983q166x4sgzps15626";
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ libc.src ];
+  extraPaths = [ libc.path ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix b/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
index 8d757a8a84304..3f2d392ba8c5d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
@@ -14,8 +14,6 @@
 
 mkDerivation {
   path = "lib/librpcsvc";
-  version = "9.2";
-  sha256 = "1q34pfiyjbrgrdqm46jwrsqms49ly6z3b0xh1wg331zga900vq5n";
   makeFlags = defaultMakeFlags ++ [ "INCSDIR=$(out)/include/rpcsvc" ];
   meta.platforms = lib.platforms.netbsd;
   nativeBuildInputs = [
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
index fa0229953b66b..4e4bf0bc5ac4b 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
@@ -7,10 +7,8 @@
 
 mkDerivation {
   path = "lib/librt";
-  version = "9.2";
-  sha256 = "07f8mpjcqh5kig5z5sp97fg55mc4dz6aa1x5g01nv2pvbmqczxc6";
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ libc.src ] ++ libc.extraPaths;
+  extraPaths = [ libc.path ] ++ libc.extraPaths;
   postPatch = ''
     sed -i 's,/usr\(/include/sys/syscall.h\),${headers}\1,g' \
       $BSDSRCDIR/lib/{libc,librt}/sys/Makefile.inc
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix
index 6ac573d865b1a..6e7b59df2ed5e 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix
@@ -12,13 +12,10 @@
   tic,
   rsync,
   compatIfNeeded,
-  fetchNetBSD,
 }:
 
 mkDerivation {
   path = "lib/libterminfo";
-  version = "9.2";
-  sha256 = "0pq05k3dj0dfsczv07frnnji92mazmy2qqngqbx2zgqc1x251414";
   nativeBuildInputs = [
     bsdSetupHook
     netbsdSetupHook
@@ -45,7 +42,5 @@ mkDerivation {
   postInstall = ''
     make -C $BSDSRCDIR/share/terminfo $makeFlags BINDIR=$out/share install
   '';
-  extraPaths = [
-    (fetchNetBSD "share/terminfo" "9.2" "1vh9rl4w8118a9qdpblfxmv1wkpm83rm9gb4rzz5bpm56i6d7kk7")
-  ];
+  extraPaths = [ "share/terminfo" ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix
index fdc57df9c231e..d5bf075fc5e7d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix
@@ -1,6 +1,5 @@
 {
   mkDerivation,
-  common,
   libc,
   sys,
   bsdSetupHook,
@@ -18,12 +17,10 @@
 
 mkDerivation {
   path = "lib/libutil";
-  version = "9.2";
-  sha256 = "02gm5a5zhh8qp5r5q5r7x8x6x50ir1i0ncgsnfwh1vnrz6mxbq7z";
   extraPaths = [
-    common
-    libc.src
-    sys.src
+    "common"
+    libc.path
+    sys.path
   ];
   nativeBuildInputs = [
     bsdSetupHook
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/locale/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/locale/package.nix
index 3c61e8517b35b..e3e06ba1a152c 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/locale/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/locale/package.nix
@@ -2,8 +2,6 @@
 
 mkDerivation {
   path = "usr.bin/locale";
-  version = "9.2";
-  sha256 = "0kk6v9k2bygq0wf9gbinliqzqpzs9bgxn0ndyl2wcv3hh2bmsr9p";
   patches = [ ./locale.patch ];
   env.NIX_CFLAGS_COMPILE = "-DYESSTR=__YESSTR -DNOSTR=__NOSTR";
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix b/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix
index 0b99a794b07a0..836fa7500e579 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix
@@ -11,8 +11,6 @@
 
 mkDerivation {
   path = "usr.bin/lorder";
-  version = "9.2";
-  sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
   nativeBuildInputs = [
     bsdSetupHook
     netbsdSetupHook
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix b/pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix
index 66086c01c233f..a1e8d1482c215 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix
@@ -9,8 +9,6 @@
 
 mkDerivation {
   path = "share/mk";
-  sha256 = "0w9x77cfnm6zwy40slradzi0ip9gz80x6lk7pvnlxzsr2m5ra5sy";
-  version = "9.2";
   noCC = true;
 
   buildInputs = [ ];
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/make.nix b/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
index 4d0b9f4b4cf22..9612ca7ff4893 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
@@ -1,15 +1,12 @@
 {
   lib,
   mkDerivation,
-  fetchNetBSD,
   stdenv,
   make-rules,
 }:
 
 mkDerivation {
   path = "usr.bin/make";
-  sha256 = "0vi73yicbmbp522qzqvd979cx6zm5jakhy77xh73c1kygf8klccs";
-  version = "9.2";
 
   postPatch =
     make-rules.postPatch
@@ -21,7 +18,5 @@ mkDerivation {
   postInstall = ''
     make -C $BSDSRCDIR/share/mk FILESDIR=$out/share/mk install
   '';
-  extraPaths = [
-    (fetchNetBSD "share/mk" "9.2" "0w9x77cfnm6zwy40slradzi0ip9gz80x6lk7pvnlxzsr2m5ra5sy")
-  ];
+  extraPaths = [ "share/mk" ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix b/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix
index 62a4d4a6a1246..ad70b6b8cd072 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix
@@ -9,8 +9,6 @@
 
 mkDerivation {
   path = "tools/make";
-  sha256 = "0fh0nrnk18m613m5blrliq2aydciv51qhc0ihsj4k63incwbk90n";
-  version = "9.2";
 
   buildInputs = [ ];
   nativeBuildInputs = [
@@ -47,5 +45,5 @@ mkDerivation {
     runHook postInstall
   '';
 
-  extraPaths = [ make.src ];
+  extraPaths = [ make.path ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/man.nix b/pkgs/os-specific/bsd/netbsd/pkgs/man.nix
index bce5bcee66946..527c547fdaad0 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/man.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/man.nix
@@ -3,8 +3,6 @@
 mkDerivation {
   path = "share/man";
   noCC = true;
-  version = "9.2";
-  sha256 = "1l4lmj4kmg8dl86x94sr45w0xdnkz8dn4zjx0ipgr9bnq98663zl";
   # man0 generates a man.pdf using ps2pdf, but doesn't install it later,
   # so we can avoid the dependency on ghostscript
   postPatch = ''
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/misc.nix b/pkgs/os-specific/bsd/netbsd/pkgs/misc.nix
index 7f96f4d1495ad..726acf27d50b0 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/misc.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/misc.nix
@@ -3,7 +3,5 @@
 mkDerivation {
   path = "share/misc";
   noCC = true;
-  version = "9.2";
-  sha256 = "1j2cdssdx6nncv8ffj7f7ybl7m9hadjj8vm8611skqdvxnjg6nbc";
   makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/share" ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
index 849d2b1da3fbf..f4f103087587d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
@@ -1,8 +1,11 @@
 {
   lib,
-  stdenvNoCC,
   stdenv,
-  fetchNetBSD,
+  stdenvNoCC,
+  crossLibcStdenv,
+  runCommand,
+  rsync,
+  source,
   bsdSetupHook,
   netbsdSetupHook,
   makeMinimal,
@@ -12,9 +15,9 @@
   mandoc,
   groff,
   statHook,
-  rsync,
   compatIfNeeded,
   defaultMakeFlags,
+  version,
 }:
 
 lib.makeOverridable (
@@ -23,10 +26,20 @@ lib.makeOverridable (
     stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
   in
   stdenv'.mkDerivation (
-    {
+    rec {
       pname = "${attrs.pname or (baseNameOf attrs.path)}-netbsd";
-      inherit (attrs) version;
-      src = fetchNetBSD attrs.path attrs.version attrs.sha256;
+      inherit version;
+      src = runCommand "${pname}-filtered-src" { nativeBuildInputs = [ rsync ]; } ''
+        for p in ${lib.concatStringsSep " " ([ attrs.path ] ++ attrs.extraPaths or [ ])}; do
+          set -x
+          path="$out/$p"
+          mkdir -p "$(dirname "$path")"
+          src_path="${source}/$p"
+          if [[ -d "$src_path" ]]; then src_path+=/; fi
+          rsync --chmod="+w" -r "$src_path" "$path"
+          set +x
+        done
+      '';
 
       extraPaths = [ ];
 
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/mknod.nix b/pkgs/os-specific/bsd/netbsd/pkgs/mknod.nix
index 5c4c172e40a7d..bf7d8b7db689b 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/mknod.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/mknod.nix
@@ -1,7 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "sbin/mknod";
-  version = "9.2";
-  sha256 = "1d9369shzwgixz3nph991i8q5vk7hr04py3n9avbfbhzy4gndqs2";
-}
+mkDerivation { path = "sbin/mknod"; }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/mtree.nix b/pkgs/os-specific/bsd/netbsd/pkgs/mtree.nix
index 723da3ad891bc..8310941c7cb22 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/mtree.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/mtree.nix
@@ -2,7 +2,5 @@
 
 mkDerivation {
   path = "usr.sbin/mtree";
-  version = "9.2";
-  sha256 = "04p7w540vz9npvyb8g8hcf2xa05phn1y88hsyrcz3vwanvpc0yv9";
-  extraPaths = [ mknod.src ];
+  extraPaths = [ mknod.path ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix b/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix
index a23c5dddfc9f8..3b52eae96c3b2 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix
@@ -1,7 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "usr.bin/nbperf";
-  version = "9.2";
-  sha256 = "1nxc302vgmjhm3yqdivqyfzslrg0vjpbss44s74rcryrl19mma9r";
-}
+mkDerivation { path = "usr.bin/nbperf"; }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh b/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh
index ef00ea418e535..8c3742a76534b 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh
@@ -1,16 +1,6 @@
-mergeNetBSDSourceDir() {
-  # merge together all extra paths
-  # there should be a better way to do this
-  chmod -R u+w $BSDSRCDIR
-  for path in $extraPaths; do
-    rsync -Er --chmod u+w $path/ $BSDSRCDIR/
-  done
-}
-
 addNetBSDMakeFlags() {
   makeFlags="INCSDIR=${!outputDev}/include $makeFlags"
   makeFlags="MANDIR=${!outputMan}/share/man $makeFlags"
 }
 
-postUnpackHooks+=(mergeNetBSDSourceDir)
 preConfigureHooks+=(addNetBSDMakeFlags)
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/rpcgen.nix b/pkgs/os-specific/bsd/netbsd/pkgs/rpcgen.nix
index b1482d4dff112..dc6ceb7bd634d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/rpcgen.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/rpcgen.nix
@@ -1,7 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "usr.bin/rpcgen";
-  version = "9.2";
-  sha256 = "1kfgfx54jg98wbg0d95p0rvf4w0302v8fz724b0bdackdsrd4988";
-}
+mkDerivation { path = "usr.bin/rpcgen"; }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/source.nix b/pkgs/os-specific/bsd/netbsd/pkgs/source.nix
new file mode 100644
index 0000000000000..432de84ffb3e1
--- /dev/null
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/source.nix
@@ -0,0 +1,12 @@
+{
+  lib,
+  fetchcvs,
+  version,
+}:
+
+fetchcvs {
+  cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot";
+  module = "src";
+  tag = "netbsd-${lib.replaceStrings [ "." ] [ "-" ] version}-RELEASE";
+  sha256 = "sha256-+onT/ajWayaKALucaZBqoiEkvBBI400Fs2OCtMf/bYU=";
+}
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix
index 397b1f5303c15..522a7a1837b18 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix
@@ -14,8 +14,6 @@
 
 mkDerivation {
   path = "usr.bin/stat";
-  version = "9.2";
-  sha256 = "18nqwlndfc34qbbgqx5nffil37jfq9aw663ippasfxd2hlyc106x";
   nativeBuildInputs = [
     bsdSetupHook
     netbsdSetupHook
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix b/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
index 4c140fa3bdef7..6a6f8a5032768 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
@@ -14,12 +14,9 @@
   config,
   genassym,
   defaultMakeFlags,
-  common,
 }:
 {
   path = "sys";
-  version = "9.2";
-  sha256 = "03s18q8d9giipf05bx199fajc2qwikji0djz7hw63d2lya6bfnpj";
 
   # Make the build ignore linker warnings
   prePatch = ''
@@ -89,5 +86,5 @@
   '';
 
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ common ];
+  extraPaths = [ "common" ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix b/pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix
index 2df35efc199ad..65fabedfcb457 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix
@@ -14,7 +14,6 @@
   config,
   genassym,
   defaultMakeFlags,
-  common,
 }:
 let
   base = import ./base.nix {
@@ -34,7 +33,6 @@ let
       config
       genassym
       defaultMakeFlags
-      common
       ;
   };
 in
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix
index c8e6edab5f48f..cb691dc87855d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix
@@ -14,7 +14,6 @@
   config,
   genassym,
   defaultMakeFlags,
-  common,
 }:
 let
   base = import ./base.nix {
@@ -34,7 +33,6 @@ let
       config
       genassym
       defaultMakeFlags
-      common
       ;
   };
 in
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix b/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix
index e0900652108fd..f71df930ce1c3 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix
@@ -11,13 +11,10 @@
   compatIfNeeded,
   defaultMakeFlags,
   libterminfo,
-  fetchNetBSD,
 }:
 
 mkDerivation {
   path = "tools/tic";
-  version = "9.2";
-  sha256 = "092y7db7k4kh2jq8qc55126r5qqvlb8lq8mhmy5ipbi36hwb4zrz";
   HOSTPROG = "tic";
   buildInputs = compatIfNeeded;
   nativeBuildInputs = [
@@ -32,8 +29,8 @@ mkDerivation {
   ];
   makeFlags = defaultMakeFlags ++ [ "TOOLDIR=$(out)" ];
   extraPaths = [
-    libterminfo.src
-    (fetchNetBSD "usr.bin/tic" "9.2" "1mwdfg7yx1g43ss378qsgl5rqhsxskqvsd2mqvrn38qw54i8v5i1")
-    (fetchNetBSD "tools/Makefile.host" "9.2" "15b4ab0n36lqj00j5lz2xs83g7l8isk3wx1wcapbrn66qmzz2sxy")
+    libterminfo.path
+    "usr.bin/tic"
+    "tools/Makefile.host"
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix b/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix
index 9200bc57a73e0..b1ab320da0c8f 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix
@@ -11,8 +11,6 @@
 
 mkDerivation {
   path = "usr.bin/tsort";
-  version = "9.2";
-  sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq";
   nativeBuildInputs = [
     bsdSetupHook
     netbsdSetupHook
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix b/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
index 7592db3eaf180..1e58df16ceeec 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
@@ -6,8 +6,6 @@
 
 mkDerivation {
   path = "usr.bin/uudecode";
-  version = "9.2";
-  sha256 = "00a3zmh15pg4vx6hz0kaa5mi8d2b1sj4h512d7p6wbvxq6mznwcn";
   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isLinux "-DNO_BASE64";
   NIX_LDFLAGS = lib.optional stdenv.isDarwin "-lresolv";
 }
diff --git a/pkgs/os-specific/darwin/macfuse/default.nix b/pkgs/os-specific/darwin/macfuse/default.nix
index c63b536f248b5..4de9600e79108 100644
--- a/pkgs/os-specific/darwin/macfuse/default.nix
+++ b/pkgs/os-specific/darwin/macfuse/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "macfuse-stubs";
-  version = "4.4.1";
+  version = "4.8.0";
 
   src = fetchurl {
     url = "https://github.com/osxfuse/osxfuse/releases/download/macfuse-${version}/macfuse-${version}.dmg";
-    sha256 = "2a2d0f37ec5fcff547c5efa7d08539103a0b46bc16080c2b41a7e749f6e65c61";
+    hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ=";
   };
 
   nativeBuildInputs = [ cpio xar undmg libtapi ];
diff --git a/pkgs/os-specific/darwin/noah/default.nix b/pkgs/os-specific/darwin/noah/default.nix
index ad63b796f1838..502a165c33d44 100644
--- a/pkgs/os-specific/darwin/noah/default.nix
+++ b/pkgs/os-specific/darwin/noah/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Bash on Ubuntu on macOS";
     homepage = "https://github.com/linux-noah/noah";
-    license = [ licenses.mit licenses.gpl2 ];
+    license = [ licenses.mit licenses.gpl2Only ];
     maintainers = [ ];
     platforms = platforms.darwin;
     # never built on aarch64-darwin since first introduction in nixpkgs
diff --git a/pkgs/os-specific/darwin/osx-cpu-temp/default.nix b/pkgs/os-specific/darwin/osx-cpu-temp/default.nix
index 4748d62f83e55..2f3154fe9ea41 100644
--- a/pkgs/os-specific/darwin/osx-cpu-temp/default.nix
+++ b/pkgs/os-specific/darwin/osx-cpu-temp/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Outputs current CPU temperature for OSX";
     homepage = "https://github.com/lavoiesl/osx-cpu-temp";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ virusdave ];
     platforms = platforms.darwin;
   };
diff --git a/pkgs/os-specific/darwin/raycast/default.nix b/pkgs/os-specific/darwin/raycast/default.nix
index 5df4990b59f2c..a49f1a305ce4a 100644
--- a/pkgs/os-specific/darwin/raycast/default.nix
+++ b/pkgs/os-specific/darwin/raycast/default.nix
@@ -11,12 +11,12 @@
 
 stdenvNoCC.mkDerivation (finalAttrs: {
   pname = "raycast";
-  version = "1.76.0";
+  version = "1.77.1";
 
   src = fetchurl {
     name = "Raycast.dmg";
     url = "https://releases.raycast.com/releases/${finalAttrs.version}/download?build=universal";
-    hash = "sha256-9qvXUmCATwugK8lB1LeSnjfr5MNCjF9QTKR29LmbKes=";
+    hash = "sha256-+Itz6U1DHV9ZsgjzuvrfVtCJ1yiGSpVOkD28BmHibIQ=";
   };
 
   dontPatch = true;
diff --git a/pkgs/os-specific/linux/afuse/default.nix b/pkgs/os-specific/linux/afuse/default.nix
index 6d8bb81b99c29..df64c0d1f56c7 100644
--- a/pkgs/os-specific/linux/afuse/default.nix
+++ b/pkgs/os-specific/linux/afuse/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Automounter in userspace";
     homepage = "https://github.com/pcarrier/afuse";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     maintainers = [ lib.maintainers.marcweber ];
     platforms = lib.platforms.unix;
   };
diff --git a/pkgs/os-specific/linux/amdgpu-pro/default.nix b/pkgs/os-specific/linux/amdgpu-pro/default.nix
deleted file mode 100644
index ade6da99810b2..0000000000000
--- a/pkgs/os-specific/linux/amdgpu-pro/default.nix
+++ /dev/null
@@ -1,222 +0,0 @@
-{ lib
-, stdenv
-, fetchurl
-, elfutils
-, xorg
-, patchelf
-, libxcb
-, libxshmfence
-, perl
-, zlib
-, expat
-, libffi_3_3
-, libselinux
-, libdrm
-, udev
-, kernel ? null
-}:
-
-with lib;
-
-let
-
-  bitness = if stdenv.is64bit then "64" else "32";
-
-  libArch =
-    if stdenv.hostPlatform.system == "i686-linux" then
-      "i386-linux-gnu"
-    else if stdenv.hostPlatform.system == "x86_64-linux" then
-      "x86_64-linux-gnu"
-    else throw "amdgpu-pro is Linux only. Sorry ${stdenv.hostPlatform.system}.";
-
-in stdenv.mkDerivation rec {
-
-  version = "21.30";
-  pname = "amdgpu-pro";
-  build = "${version}-1290604";
-
-  src = fetchurl {
-    url = "https://drivers.amd.com/drivers/linux/amdgpu-pro-${build}-ubuntu-20.04.tar.xz";
-    sha256 = "sha256-WECqxjo2WLP3kMWeVyJgYufkvHTzwGaj57yeMGXiQ4I=";
-    curlOpts = "--referer https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-21-30";
-  };
-
-  postUnpack = ''
-    mkdir root
-    pushd $sourceRoot
-    for deb in *_all.deb *_${if stdenv.is64bit then "amd64" else "i386"}.deb
-    do
-      ar p $deb data.tar.xz | tar -C ../root -xJ
-    done
-    popd
-    # if we don't use a short sourceRoot, compilation can fail due to command
-    # line length
-    sourceRoot=root
-  '';
-
-  passthru = optionalAttrs (kernel != null) {
-    kmod = stdenv.mkDerivation rec {
-      inherit version src postUnpack;
-      name = "${pname}-${version}-kmod-${kernel.dev.version}";
-
-      postPatch = ''
-        pushd usr/src/amdgpu-*
-        patchShebangs amd/dkms/*.sh
-        substituteInPlace amd/dkms/pre-build.sh --replace "./configure" "./configure --with-linux=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source --with-linux-obj=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
-        popd
-      '';
-
-      preConfigure = ''
-        pushd usr/src/amdgpu-*
-        makeFlags="$makeFlags M=$(pwd)"
-        amd/dkms/pre-build.sh ${kernel.version}
-        popd
-      '';
-
-      postBuild = ''
-        pushd usr/src/amdgpu-*
-        find -name \*.ko -exec xz {} \;
-        popd
-      '';
-
-      makeFlags = optionalString (kernel != null) "-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build modules";
-
-      installPhase = ''
-        runHook preInstall
-
-        pushd usr/src/amdgpu-*
-        find -name \*.ko.xz -exec install -Dm444 {} $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/gpu/drm/{} \;
-        popd
-
-        runHook postInstall
-      '';
-
-      # without this we get a collision with the ttm module from linux
-      meta.priority = 4;
-    };
-
-    fw = stdenv.mkDerivation rec {
-      inherit version src postUnpack;
-      name = "${pname}-${version}-fw";
-
-      installPhase = ''
-        runHook preInstall
-
-        mkdir -p $out/lib
-        cp -r usr/src/amdgpu-*/firmware $out/lib/firmware
-
-        runHook postInstall
-      '';
-    };
-  };
-
-  outputs = [ "out" "vulkan" ];
-
-  depLibPath = makeLibraryPath [
-    stdenv.cc.cc.lib
-    zlib
-    libxcb
-    libxshmfence
-    elfutils
-    expat
-    libffi_3_3
-    libselinux
-    # libudev is not listed in any dependencies, but is loaded dynamically
-    udev
-    xorg.libXext
-    xorg.libX11
-    xorg.libXfixes
-    xorg.libXdamage
-    xorg.libXxf86vm
-  ];
-
-  installPhase = ''
-    runHook preInstall
-
-    mkdir -p $out
-
-    cp -r usr/lib/${libArch} $out/lib
-    cp -r usr/share $out/share
-
-    mkdir -p $out/opt/amdgpu{,-pro}
-    cp -r opt/amdgpu-pro/lib/${libArch} $out/opt/amdgpu-pro/lib
-    cp -r opt/amdgpu/lib/${libArch} $out/opt/amdgpu/lib
-
-    pushd $out/lib
-    ln -s ../opt/amdgpu-pro/lib/libGL.so* .
-    ln -s ../opt/amdgpu-pro/lib/libEGL.so* .
-    popd
-
-    # short name to allow replacement below
-    ln -s lib/dri $out/dri
-
-  '' + optionalString (stdenv.is64bit) ''
-    mkdir -p $out/etc
-    pushd etc
-    cp -r modprobe.d udev amd $out/etc
-    popd
-
-    cp -r lib/udev/rules.d/* $out/etc/udev/rules.d
-    cp -r opt/amdgpu/lib/xorg $out/lib/xorg
-    cp -r opt/amdgpu-pro/lib/xorg/* $out/lib/xorg
-    cp -r opt/amdgpu/share $out/opt/amdgpu/share
-  '' + ''
-
-    mkdir -p $vulkan/share/vulkan/icd.d
-    install opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd${bitness}.json $vulkan/share/vulkan/icd.d
-
-    runHook postInstall
-  '';
-
-  preFixup = (if stdenv.is64bit
-    # this could also be done with LIBGL_DRIVERS_PATH, but it would need to be
-    # set in the user session and for Xorg
-    then ''
-      expr1='s:/opt/amdgpu/lib/x86_64-linux-gnu/dri\0:/run/opengl-driver/lib/dri\0\0\0\0\0\0\0\0\0\0\0:g'
-      expr2='s:/usr/lib/x86_64-linux-gnu/dri[\0\:]:/run/opengl-driver/lib/dri\0\0\0\0:g'
-      perl -pi -e "$expr2" $out/lib/xorg/modules/extensions/libglx.so
-    ''
-    else ''
-      expr1='s:/opt/amdgpu/lib/i386-linux-gnu/dri\0:/run/opengl-driver-32/lib/dri\0\0\0\0\0\0:g'
-      # we replace a different path on 32-bit because it's the only one long
-      # enough to fit the target path :(
-      expr2='s:/usr/lib/i386-linux-gnu/dri[\0\:]:/run/opengl-driver-32/dri\0\0\0:g'
-    '') + ''
-    perl -pi -e "$expr1" \
-      $out/opt/amdgpu/lib/libEGL.so.1.0.0 \
-      $out/opt/amdgpu/lib/libgbm.so.1.0.0 \
-      $out/opt/amdgpu/lib/libGL.so.1.2.0
-
-    perl -pi -e "$expr2" \
-      $out/opt/amdgpu-pro/lib/libEGL.so.1 \
-      $out/opt/amdgpu-pro/lib/libGL.so.1.2 \
-      $out/opt/amdgpu-pro/lib/libGLX_amd.so.0
-
-    find $out -type f -exec perl -pi -e 's:/opt/amdgpu-pro/:/run/amdgpu-pro/:g' {} \;
-    find $out -type f -exec perl -pi -e 's:/opt/amdgpu/:/run/amdgpu/:g' {} \;
-
-    substituteInPlace $vulkan/share/vulkan/icd.d/*.json --replace /opt/amdgpu-pro/lib/${libArch} "$out/opt/amdgpu-pro/lib"
-  '';
-
-  # doing this in post because shrinking breaks things that dynamically load
-  postFixup = ''
-    libPath="$out/opt/amdgpu/lib:$out/opt/amdgpu-pro/lib:$depLibPath"
-    find "$out" -name '*.so*' -type f -exec patchelf --set-rpath "$libPath" {} \;
-  '';
-
-  buildInputs = [
-    libdrm
-    patchelf
-    perl
-  ];
-
-  enableParallelBuilding = true;
-
-  meta = with lib; {
-    description = "AMDGPU-PRO drivers";
-    homepage =  "https://www.amd.com/en/support";
-    license = licenses.unfree;
-    platforms = platforms.linux;
-    maintainers = with maintainers; [ corngood ];
-  };
-}
diff --git a/pkgs/os-specific/linux/anbox/default.nix b/pkgs/os-specific/linux/anbox/default.nix
index 3a5649d9f2882..8f963f34136ac 100644
--- a/pkgs/os-specific/linux/anbox/default.nix
+++ b/pkgs/os-specific/linux/anbox/default.nix
@@ -58,6 +58,7 @@ stdenv.mkDerivation rec {
     cmake
     pkg-config
     makeWrapper
+    protobufc
   ];
 
   buildInputs = [
@@ -74,7 +75,7 @@ stdenv.mkDerivation rec {
     lxc
     mesa
     properties-cpp
-    protobuf protobufc
+    protobuf
     python3
     SDL2 SDL2_image
     systemd
@@ -164,7 +165,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://anbox.io";
     description = "Android in a box";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ edwtjo ];
     platforms = [ "armv7l-linux" "aarch64-linux" "x86_64-linux" ];
   };
diff --git a/pkgs/os-specific/linux/apparmor/default.nix b/pkgs/os-specific/linux/apparmor/default.nix
index 4c06ea352ee03..f70ba4c7aad18 100644
--- a/pkgs/os-specific/linux/apparmor/default.nix
+++ b/pkgs/os-specific/linux/apparmor/default.nix
@@ -1,4 +1,5 @@
 { stdenv, lib, fetchFromGitLab, fetchpatch, makeWrapper, autoreconfHook
+, autoconf-archive
 , pkg-config, which
 , flex, bison
 , linuxHeaders ? stdenv.cc.libc.linuxHeaders
@@ -22,7 +23,7 @@
 }:
 
 let
-  apparmor-version = "3.1.7";
+  apparmor-version = "4.0.1";
 
   apparmor-meta = component: with lib; {
     homepage = "https://apparmor.net/";
@@ -36,7 +37,7 @@ let
     owner = "apparmor";
     repo = "apparmor";
     rev = "v${apparmor-version}";
-    hash = "sha256-AzY05bcpNYXix2GL4Rhc9d3RBA1pd2fwOa7yoiwc2nQ=";
+    hash = "sha256-0S/P62wi3/aPATvJL6afu+SebjoSHsTMu/WV9m7E1OE=";
   };
 
   aa-teardown = writeShellScript "aa-teardown" ''
@@ -86,6 +87,7 @@ let
     strictDeps = false;
 
     nativeBuildInputs = [
+      autoconf-archive
       autoreconfHook
       bison
       flex
diff --git a/pkgs/os-specific/linux/asus-ec-sensors/default.nix b/pkgs/os-specific/linux/asus-ec-sensors/default.nix
index c80f18a78ecea..ae5c370ed21f6 100644
--- a/pkgs/os-specific/linux/asus-ec-sensors/default.nix
+++ b/pkgs/os-specific/linux/asus-ec-sensors/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Linux HWMON sensors driver for ASUS motherboards to read sensor data from the embedded controller";
     homepage = "https://github.com/zeule/asus-ec-sensors";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = [ "x86_64-linux" ];
     maintainers = with maintainers; [ nickhu ];
     broken = kernel.kernelOlder "5.11";
diff --git a/pkgs/os-specific/linux/asus-wmi-sensors/default.nix b/pkgs/os-specific/linux/asus-wmi-sensors/default.nix
index 3098cbb72538e..074b2e4ff25af 100644
--- a/pkgs/os-specific/linux/asus-wmi-sensors/default.nix
+++ b/pkgs/os-specific/linux/asus-wmi-sensors/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Linux HWMON (lmsensors) sensors driver for various ASUS Ryzen and Threadripper motherboards";
     homepage = "https://github.com/electrified/asus-wmi-sensors";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = [ "x86_64-linux" "i686-linux" ];
     maintainers = with maintainers; [ Frostman ];
     broken = versionOlder kernel.version "4.12";
diff --git a/pkgs/os-specific/linux/autofs/default.nix b/pkgs/os-specific/linux/autofs/default.nix
index db0e7b48383f3..d308ba6594e23 100644
--- a/pkgs/os-specific/linux/autofs/default.nix
+++ b/pkgs/os-specific/linux/autofs/default.nix
@@ -1,28 +1,33 @@
 { lib, stdenv, fetchurl, flex, bison, linuxHeaders, libtirpc, mount, umount, nfs-utils, e2fsprogs
-, libxml2, libkrb5, kmod, openldap, sssd, cyrus_sasl, openssl, rpcsvc-proto
+, libxml2, libkrb5, kmod, openldap, sssd, cyrus_sasl, openssl, rpcsvc-proto, pkgconf
 , fetchpatch
 }:
 
 stdenv.mkDerivation rec {
-  version = "5.1.6";
+  version = "5.1.9";
   pname = "autofs";
 
   src = fetchurl {
     url = "mirror://kernel/linux/daemons/autofs/v5/autofs-${version}.tar.xz";
-    sha256 = "1vya21mb4izj3khcr3flibv7xc15vvx2v0rjfk5yd31qnzcy7pnx";
+    sha256 = "sha256-h+avagN5S5Ri6lGXgeUOfSO198ks1Z4RQshdJJOzwks=";
   };
-
   patches = [
-    # glibc 2.34 compat
     (fetchpatch {
-      url = "https://src.fedoraproject.org/rpms/autofs/raw/cc745af5e42396d540d5b3b92fae486e232bf6bd/f/autofs-5.1.7-use-default-stack-size-for-threads.patch";
-      sha256 = "sha256-6ETDFbW7EhHR03xFWF+6OJBgn9NX3WW3bGhTNGodaOc=";
-      excludes = [ "CHANGELOG" ];
+      url = "mirror://kernel/linux/daemons/autofs/v5/patches-5.2.0/autofs-5.1.9-update-configure.patch";
+      hash = "sha256-BomhNw+lMHcgs5gQlzapZ6p/Ji3gJUVkrLpZssBmwbg=";
+    })
+    (fetchpatch {
+      url = "mirror://kernel/linux/daemons/autofs/v5/patches-5.2.0/autofs-5.1.9-fix-ldap_parse_page_control-check.patch";
+      hash = "sha256-W757LU9r9kuzLeThif2a1olRtxNrJy5suemLS7yfbIU=";
+    })
+   (fetchpatch {
+      url = "mirror://kernel/linux/daemons/autofs/v5/patches-5.2.0/autofs-5.1.9-fix-crash-in-make_options_string.patch";
+      hash = "sha256-YjTdJ50iNhJ2UjFdrKYEFNt04z0PfmElbFa4GuSskLA=";
     })
   ];
 
   preConfigure = ''
-    configureFlags="--enable-force-shutdown --enable-ignore-busy --with-path=$PATH"
+    configureFlags="--enable-force-shutdown --enable-ignore-busy --with-path=$PATH --with-libtirpc"
     export sssldir="${sssd}/lib/sssd/modules"
     export HAVE_SSS_AUTOFS=1
 
@@ -37,9 +42,6 @@ stdenv.mkDerivation rec {
     unset STRIP # Makefile.rules defines a usable STRIP only without the env var.
   '';
 
-  # configure script is not finding the right path
-  env.NIX_CFLAGS_COMPILE = toString [ "-I${libtirpc.dev}/include/tirpc" ];
-
   installPhase = ''
     make install SUBDIRS="lib daemon modules man" # all but samples
     #make install SUBDIRS="samples" # impure!
@@ -48,7 +50,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ linuxHeaders libtirpc libxml2 libkrb5 kmod openldap sssd
                   openssl cyrus_sasl rpcsvc-proto ];
 
-  nativeBuildInputs = [ flex bison ];
+  nativeBuildInputs = [ flex bison pkgconf ];
 
   meta = {
     description = "Kernel-based automounter";
diff --git a/pkgs/os-specific/linux/ax99100/default.nix b/pkgs/os-specific/linux/ax99100/default.nix
index 761800cfd7ba9..0e99d9390c15f 100644
--- a/pkgs/os-specific/linux/ax99100/default.nix
+++ b/pkgs/os-specific/linux/ax99100/default.nix
@@ -44,7 +44,7 @@ stdenv.mkDerivation {
     description = "ASIX AX99100 Serial and Parallel Port driver";
     homepage = "https://www.asix.com.tw/en/product/Interface/PCIe_Bridge/AX99100";
     # According to the source code in the tarball, the license is gpl2.
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Plus;
     platforms = lib.platforms.linux;
 
     # Older Linux versions need more patches to work.
diff --git a/pkgs/os-specific/linux/batman-adv/alfred.nix b/pkgs/os-specific/linux/batman-adv/alfred.nix
index ae7d784591d2b..26c433b8a06d9 100644
--- a/pkgs/os-specific/linux/batman-adv/alfred.nix
+++ b/pkgs/os-specific/linux/batman-adv/alfred.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://www.open-mesh.org/projects/batman-adv/wiki/Wiki";
     description = "B.A.T.M.A.N. routing protocol in a linux kernel module for layer 2, information distribution tool";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     maintainers = with lib.maintainers; [ fpletz ];
     platforms = with lib.platforms; linux;
   };
diff --git a/pkgs/os-specific/linux/batman-adv/batctl.nix b/pkgs/os-specific/linux/batman-adv/batctl.nix
index bb44ac5e99f56..e42b1b18d5841 100644
--- a/pkgs/os-specific/linux/batman-adv/batctl.nix
+++ b/pkgs/os-specific/linux/batman-adv/batctl.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     homepage = "https://www.open-mesh.org/projects/batman-adv/wiki/Wiki";
     description = "B.A.T.M.A.N. routing protocol in a linux kernel module for layer 2, control tool";
     mainProgram = "batctl";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     maintainers = with lib.maintainers; [ fpletz ];
     platforms = with lib.platforms; linux;
   };
diff --git a/pkgs/os-specific/linux/batman-adv/default.nix b/pkgs/os-specific/linux/batman-adv/default.nix
index 3d8fbafb2358c..8fa54664fb4dd 100644
--- a/pkgs/os-specific/linux/batman-adv/default.nix
+++ b/pkgs/os-specific/linux/batman-adv/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://www.open-mesh.org/projects/batman-adv/wiki/Wiki";
     description = "B.A.T.M.A.N. routing protocol in a linux kernel module for layer 2";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     maintainers = with lib.maintainers; [ fpletz philiptaron ];
     platforms = with lib.platforms; linux;
   };
diff --git a/pkgs/os-specific/linux/batman-adv/version.nix b/pkgs/os-specific/linux/batman-adv/version.nix
index 6292552dd5546..6f0cab252b926 100644
--- a/pkgs/os-specific/linux/batman-adv/version.nix
+++ b/pkgs/os-specific/linux/batman-adv/version.nix
@@ -1,16 +1,16 @@
 {
-  version = "2024.1";
+  version = "2024.2";
 
   # To get these, run:
   #
   # ```
   # for tool in alfred batctl batman-adv; do
-  #   nix-prefetch-url https://downloads.open-mesh.org/batman/releases/batman-adv-2024.1/$tool-2024.1.tar.gz --type sha256 | xargs nix hash to-sri --type sha256
+  #   nix-prefetch-url https://downloads.open-mesh.org/batman/releases/batman-adv-2024.2/$tool-2024.2.tar.gz --type sha256 | xargs nix hash to-sri --type sha256
   # done
   # ```
   sha256 = {
-    alfred = "sha256-Ji2tOcm+EirH8GFwXIo+O21GJ4K74zcubfyazgw4Tbk=";
-    batctl = "sha256-aD3anWBU6yYKGsACLGQnmP9ASNbFOmcuoLMXjmt1egk=";
-    batman-adv = "sha256-pxQynGJR9IMOnPA/U8v7IoDwZ4RxtUxdRvrmGngtQyU=";
+    alfred = "sha256-Kpvr62fIh1n+31fRjm79qtDECPIGikYlIBfCJ8sQlnI=";
+    batctl = "sha256-ywKVMJP/wscA0SLAOj2eTYZ/ZG0wOPMdCpAeWP+ZXQc=";
+    batman-adv = "sha256-dpKm3uei8/ZnMumuyMcWTgwYGBZ/OvBjv/P/+7AZlkM=";
   };
 }
diff --git a/pkgs/os-specific/linux/bpftools/default.nix b/pkgs/os-specific/linux/bpftools/default.nix
index 9ec4778ca38ce..eda3fe62fa804 100644
--- a/pkgs/os-specific/linux/bpftools/default.nix
+++ b/pkgs/os-specific/linux/bpftools/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage    = "https://github.com/libbpf/bpftool";
     description = "Debugging/program analysis tools for the eBPF subsystem";
-    license     = [ licenses.gpl2 licenses.bsd2 ];
+    license     = [ licenses.gpl2Only licenses.bsd2 ];
     platforms   = platforms.linux;
     maintainers = with maintainers; [ thoughtpolice ];
   };
diff --git a/pkgs/os-specific/linux/bpftune/default.nix b/pkgs/os-specific/linux/bpftune/default.nix
index 8747ef3d928f2..cc97ed16faea1 100644
--- a/pkgs/os-specific/linux/bpftune/default.nix
+++ b/pkgs/os-specific/linux/bpftune/default.nix
@@ -12,31 +12,28 @@
 
 stdenv.mkDerivation rec {
   pname = "bpftune";
-  version = "0-unstable-2024-05-17";
+  version = "0-unstable-2024-06-07";
 
   src = fetchFromGitHub {
     owner = "oracle";
     repo = "bpftune";
-    rev = "83115c56cf9620fe5669f4a3be67ab779d8f4536";
-    hash = "sha256-er2i7CEUXF3BpWTG//s8C0xfIk5gSVOHB8nE1r7PX78=";
+    rev = "04bab5dd306b55b3e4e13e261af2480b7ccff9fc";
+    hash = "sha256-kVjvupZ6HxJocwXWOrxUNqEGl0welJRlZwvOmMKqeBA=";
   };
 
   postPatch = ''
     # otherwise shrink rpath would drop $out/lib from rpath
     substituteInPlace src/Makefile \
-      --replace /lib64   /lib \
-      --replace /sbin    /bin \
-      --replace ldconfig true
+      --replace-fail /lib64   /lib \
+      --replace-fail /sbin    /bin \
+      --replace-fail ldconfig true
     substituteInPlace src/bpftune.service \
-      --replace /usr/sbin/bpftune "$out/bin/bpftune"
+      --replace-fail /usr/sbin/bpftune "$out/bin/bpftune"
     substituteInPlace include/bpftune/libbpftune.h \
-      --replace /usr/lib64/bpftune/       "$out/lib/bpftune/" \
-      --replace /usr/local/lib64/bpftune/ "$out/lib/bpftune/"
+      --replace-fail /usr/lib64/bpftune/       "$out/lib/bpftune/" \
+      --replace-fail /usr/local/lib64/bpftune/ "$out/lib/bpftune/"
     substituteInPlace src/libbpftune.c \
-      --replace /lib/modules /run/booted-system/kernel-modules/lib/modules
-
-    substituteInPlace src/Makefile sample_tuner/Makefile \
-      --replace 'BPF_INCLUDE := /usr/include' 'BPF_INCLUDE := ${lib.getDev libbpf}/include' \
+      --replace-fail /lib/modules /run/booted-system/kernel-modules/lib/modules
   '';
 
   nativeBuildInputs = [
@@ -56,6 +53,7 @@ stdenv.mkDerivation rec {
     "confprefix=${placeholder "out"}/etc"
     "BPFTUNE_VERSION=${version}"
     "NL_INCLUDE=${lib.getDev libnl}/include/libnl3"
+    "BPF_INCLUDE=${lib.getDev libbpf}/include"
   ];
 
   hardeningDisable = [
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index 33fa7663f46dd..4a291cc03b8f6 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -121,6 +121,10 @@ stdenv.mkDerivation rec {
     # Bump from 4KB, much faster I/O
     CONFIG_FEATURE_COPYBUF_KB 64
 
+    # Doesn't build with current kernel headers.
+    # https://bugs.busybox.net/show_bug.cgi?id=15934
+    CONFIG_TC n
+
     # Set the path for the udhcpc script
     CONFIG_UDHCPC_DEFAULT_SCRIPT "${outDispatchPath}"
 
diff --git a/pkgs/os-specific/linux/can-isotp/default.nix b/pkgs/os-specific/linux/can-isotp/default.nix
index 7c20b74e54cb4..06329478ded46 100644
--- a/pkgs/os-specific/linux/can-isotp/default.nix
+++ b/pkgs/os-specific/linux/can-isotp/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation {
     broken = kernel.kernelAtLeast "5.16";
     description = "Kernel module for ISO-TP (ISO 15765-2)";
     homepage = "https://github.com/hartkopp/can-isotp";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
     maintainers = [ maintainers.evck ];
   };
diff --git a/pkgs/os-specific/linux/cpupower/default.nix b/pkgs/os-specific/linux/cpupower/default.nix
index 7c1b031d83349..f714ce54dd58d 100644
--- a/pkgs/os-specific/linux/cpupower/default.nix
+++ b/pkgs/os-specific/linux/cpupower/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation {
   meta = with lib; {
     description = "Tool to examine and tune power saving features";
     homepage = "https://www.kernel.org/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     mainProgram = "cpupower";
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/cramfsprogs/default.nix b/pkgs/os-specific/linux/cramfsprogs/default.nix
index 59fbfed1b7287..bde2686624d3c 100644
--- a/pkgs/os-specific/linux/cramfsprogs/default.nix
+++ b/pkgs/os-specific/linux/cramfsprogs/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Tools to create, check, and extract content of CramFs images";
     homepage = "https://packages.debian.org/jessie/cramfsprogs";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ pamplemousse ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/criu/default.nix b/pkgs/os-specific/linux/criu/default.nix
index 66e3303890b03..bdae94f78b4de 100644
--- a/pkgs/os-specific/linux/criu/default.nix
+++ b/pkgs/os-specific/linux/criu/default.nix
@@ -97,7 +97,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Userspace checkpoint/restore for Linux";
     homepage    = "https://criu.org";
-    license     = licenses.gpl2;
+    license     = licenses.gpl2Plus;
     platforms   = [ "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
     maintainers = [ maintainers.thoughtpolice ];
   };
diff --git a/pkgs/os-specific/linux/cryptsetup/default.nix b/pkgs/os-specific/linux/cryptsetup/default.nix
index 0e32966615ac1..39f03c475fdaa 100644
--- a/pkgs/os-specific/linux/cryptsetup/default.nix
+++ b/pkgs/os-specific/linux/cryptsetup/default.nix
@@ -14,14 +14,14 @@
 
 stdenv.mkDerivation rec {
   pname = "cryptsetup";
-  version = "2.7.1";
+  version = "2.7.3";
 
   outputs = [ "bin" "out" "dev" "man" ];
   separateDebugInfo = true;
 
   src = fetchurl {
     url = "mirror://kernel/linux/utils/cryptsetup/v${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
-    hash = "sha256-2l0UGeKobgGqMv15WCzVTSCIV8tUG8ov1Cal/xqqu8M=";
+    hash = "sha256-t3KuT23wzucgCyjOqWDk2q/yogPS/VAr6rPBMXsHpFY=";
   };
 
   patches = [
@@ -80,7 +80,7 @@ stdenv.mkDerivation rec {
     homepage = "https://gitlab.com/cryptsetup/cryptsetup/";
     description = "LUKS for dm-crypt";
     changelog = "https://gitlab.com/cryptsetup/cryptsetup/-/raw/v${version}/docs/v${version}-ReleaseNotes";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Plus;
     mainProgram = "cryptsetup";
     maintainers = with lib.maintainers; [ raitobezarius ];
     platforms = with lib.platforms; linux;
diff --git a/pkgs/os-specific/linux/digimend/default.nix b/pkgs/os-specific/linux/digimend/default.nix
index a30d7cbe3a32a..31d68acc53166 100644
--- a/pkgs/os-specific/linux/digimend/default.nix
+++ b/pkgs/os-specific/linux/digimend/default.nix
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "DIGImend graphics tablet drivers for the Linux kernel";
     homepage = "https://digimend.github.io/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ gebner ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/directvnc/default.nix b/pkgs/os-specific/linux/directvnc/default.nix
index 78ccb67725713..5ec40370bbbaa 100644
--- a/pkgs/os-specific/linux/directvnc/default.nix
+++ b/pkgs/os-specific/linux/directvnc/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation {
   meta = with lib; {
     description = "DirectFB VNC client";
     homepage = "http://drinkmilk.github.io/directvnc/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = [ maintainers.raskin ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix
index bd5d9db661a88..3fd703c7ce1e8 100644
--- a/pkgs/os-specific/linux/dpdk/default.nix
+++ b/pkgs/os-specific/linux/dpdk/default.nix
@@ -82,7 +82,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Set of libraries and drivers for fast packet processing";
     homepage = "http://dpdk.org/";
-    license = with licenses; [ lgpl21 gpl2 bsd2 ];
+    license = with licenses; [ lgpl21 gpl2Only bsd2 ];
     platforms =  platforms.linux;
     maintainers = with maintainers; [ magenbluten orivej mic92 zhaofengli ];
   };
diff --git a/pkgs/os-specific/linux/dstat/default.nix b/pkgs/os-specific/linux/dstat/default.nix
index 75b613075e781..7fbd314a8ec7f 100644
--- a/pkgs/os-specific/linux/dstat/default.nix
+++ b/pkgs/os-specific/linux/dstat/default.nix
@@ -35,7 +35,7 @@ python3Packages.buildPythonApplication rec {
     homepage = "http://dag.wieers.com/home-made/dstat/";
     description = "Versatile resource statistics tool";
     mainProgram = "dstat";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ ];
     changelog = "https://github.com/dstat-real/dstat/blob/v${version}/ChangeLog";
diff --git a/pkgs/os-specific/linux/e1000e/default.nix b/pkgs/os-specific/linux/e1000e/default.nix
index 51bc6ada07dec..1ed7f6aa0193a 100644
--- a/pkgs/os-specific/linux/e1000e/default.nix
+++ b/pkgs/os-specific/linux/e1000e/default.nix
@@ -32,6 +32,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Linux kernel drivers for Intel Ethernet adapters and LOMs (LAN On Motherboard)";
     homepage = "http://e1000.sf.net/";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
   };
 }
diff --git a/pkgs/os-specific/linux/ebtables/default.nix b/pkgs/os-specific/linux/ebtables/default.nix
index 57bf7da7c049e..bd39175050e94 100644
--- a/pkgs/os-specific/linux/ebtables/default.nix
+++ b/pkgs/os-specific/linux/ebtables/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Filtering tool for Linux-based bridging firewalls";
     homepage = "http://ebtables.sourceforge.net/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/edac-utils/default.nix b/pkgs/os-specific/linux/edac-utils/default.nix
index 6171f8ed3073e..b23e0d34401a9 100644
--- a/pkgs/os-specific/linux/edac-utils/default.nix
+++ b/pkgs/os-specific/linux/edac-utils/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
   meta = with lib; {
     homepage = "https://github.com/grondo/edac-utils";
     description = "Handles the reporting of hardware-related memory errors";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ell/default.nix b/pkgs/os-specific/linux/ell/default.nix
index 9c16a341a478f..1a5e119ef4737 100644
--- a/pkgs/os-specific/linux/ell/default.nix
+++ b/pkgs/os-specific/linux/ell/default.nix
@@ -9,14 +9,14 @@
 
 stdenv.mkDerivation rec {
   pname = "ell";
-  version = "0.64";
+  version = "0.65";
 
   outputs = [ "out" "dev" ];
 
   src = fetchgit {
     url = "https://git.kernel.org/pub/scm/libs/ell/ell.git";
     rev = version;
-    hash = "sha256-LONfgFgPg8KCDwtw//WTOYQT9RpnIskdHAWcgafOhcg=";
+    hash = "sha256-q0C9KfWHxdmrG7xcbb8zpFL4ro+BJb7BL2tyKdFIhew=";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/os-specific/linux/ethq/default.nix b/pkgs/os-specific/linux/ethq/default.nix
index 581382e4faf2d..94f18cccd9439 100644
--- a/pkgs/os-specific/linux/ethq/default.nix
+++ b/pkgs/os-specific/linux/ethq/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "ethq";
-  version = "0.6.3";
+  version = "0.7.0";
 
   src = fetchFromGitHub {
     owner = "isc-projects";
     repo = "ethq";
     rev = "refs/tags/v${builtins.replaceStrings ["."] ["_"] version}";
-    hash = "sha256-dr37KiSnP0S0OjQof242EcbH+y4pCCzu6R9D6fXR9qc=";
+    hash = "sha256-ye5ep9EM9Sq/NqNZHENPmFZefVBx1BGrPm3YEG1NcSc=";
   };
 
   buildInputs = [ ncurses ];
diff --git a/pkgs/os-specific/linux/eventstat/default.nix b/pkgs/os-specific/linux/eventstat/default.nix
index 3c551939c7cf2..beb3cc6e97143 100644
--- a/pkgs/os-specific/linux/eventstat/default.nix
+++ b/pkgs/os-specific/linux/eventstat/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     description = "Simple monitoring of system events";
     mainProgram = "eventstat";
     homepage = "https://github.com/ColinIanKing/eventstat";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ ];
   };
diff --git a/pkgs/os-specific/linux/exfat/default.nix b/pkgs/os-specific/linux/exfat/default.nix
index e247bbb9e837c..c252238f7bd69 100644
--- a/pkgs/os-specific/linux/exfat/default.nix
+++ b/pkgs/os-specific/linux/exfat/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "exfat kernel module";
     inherit (src.meta) homepage;
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Plus;
     maintainers = with lib.maintainers; [ makefu ];
     platforms = lib.platforms.linux;
     broken = true;
diff --git a/pkgs/os-specific/linux/facetimehd/default.nix b/pkgs/os-specific/linux/facetimehd/default.nix
index ceba075758a6a..4fa670afb3962 100644
--- a/pkgs/os-specific/linux/facetimehd/default.nix
+++ b/pkgs/os-specific/linux/facetimehd/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://github.com/patjak/bcwc_pcie";
     description = "Linux driver for the Facetime HD (Broadcom 1570) PCIe webcam";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ womfoo grahamc kraem ];
     platforms = [ "i686-linux" "x86_64-linux" ];
   };
diff --git a/pkgs/os-specific/linux/fbterm/default.nix b/pkgs/os-specific/linux/fbterm/default.nix
index 8704c72a21ba2..f472ce23aa2f7 100644
--- a/pkgs/os-specific/linux/fbterm/default.nix
+++ b/pkgs/os-specific/linux/fbterm/default.nix
@@ -99,7 +99,7 @@ stdenv.mkDerivation rec {
     mainProgram = "fbterm";
     homepage = "https://salsa.debian.org/debian/fbterm";
     maintainers = with maintainers; [ lovesegfault raskin ];
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ffado/default.nix b/pkgs/os-specific/linux/ffado/default.nix
index 610f9d31353e2..f7549787f4379 100644
--- a/pkgs/os-specific/linux/ffado/default.nix
+++ b/pkgs/os-specific/linux/ffado/default.nix
@@ -1,39 +1,49 @@
-{ lib
-, stdenv
-, mkDerivation
-, argp-standalone
-, dbus
-, dbus_cplusplus
-, desktop-file-utils
-, fetchurl
-, fetchpatch
-, glibmm
-, libavc1394
-, libconfig
-, libiec61883
-, libraw1394
-, libxmlxx3
-, pkg-config
-, python3
-, scons
-, which
-, wrapQtAppsHook
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  argp-standalone,
+  dbus,
+  dbus_cplusplus,
+  desktop-file-utils,
+  fetchurl,
+  fetchpatch,
+  glibmm,
+  libavc1394,
+  libconfig,
+  libiec61883,
+  libraw1394,
+  libxmlxx3,
+  pkg-config,
+  python3,
+  scons,
+  which,
+  wrapQtAppsHook,
 }:
 
 let
-  python = python3.withPackages (pkgs: with pkgs; [ pyqt5 dbus-python ]);
+  python = python3.withPackages (
+    pkgs: with pkgs; [
+      pyqt5
+      dbus-python
+    ]
+  );
 in
 mkDerivation rec {
   pname = "ffado";
   version = "2.4.8";
 
+  outputs = [
+    "out"
+    "bin"
+    "dev"
+  ];
+
   src = fetchurl {
     url = "http://www.ffado.org/files/libffado-${version}.tgz";
-    hash = "sha256-f0x561ehKw6uMSri0RZip+v1JHZuhixtywl0PVU/N44=";
+    hash = "sha256-0iFXYyGctOoHCdc232Ud80/wV81tiS7ItiS0uLKyq2Y=";
   };
 
-  sourceRoot = "libffado-${version}/libffado";
-
   prePatch = ''
     substituteInPlace ./support/tools/ffado-diag.in \
       --replace /lib/modules/ "/run/booted-system/kernel-modules/lib/modules/"
@@ -51,8 +61,6 @@ mkDerivation rec {
     })
   ];
 
-  outputs = [ "out" "bin" "dev" ];
-
   nativeBuildInputs = [
     desktop-file-utils
     scons
@@ -116,7 +124,10 @@ mkDerivation rec {
     homepage = "http://www.ffado.org";
     description = "FireWire audio drivers";
     license = licenses.gpl3;
-    maintainers = with maintainers; [ goibhniu michojel ];
+    maintainers = with maintainers; [
+      goibhniu
+      michojel
+    ];
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ffado/fix-build.patch b/pkgs/os-specific/linux/ffado/fix-build.patch
index 7e360932613f7..db4c47fa38d5f 100644
--- a/pkgs/os-specific/linux/ffado/fix-build.patch
+++ b/pkgs/os-specific/linux/ffado/fix-build.patch
@@ -1,9 +1,14 @@
 From b0f2b20b23780dd2e67a01c15462070dd86c4ac1 Mon Sep 17 00:00:00 2001
 From: Jan Tojnar <jtojnar@gmail.com>
 Date: Sun, 3 Mar 2019 11:50:27 +0100
-Subject: [PATCH] Fix build on Nix
+Subject: [PATCH] build: Add datadir option for /usr/share
 
-We do not have global /usr.
+Hardcoded /usr/share does not work for platforms that do not have global /usr like Nix.
+Let’s introduce a new DATADIR option, that allows overriding the directory and use it for metainfodir.
+
+While at it, let’s also use it for SHAREDIR and MANDIR for consistency,
+following the GNU directory convention:
+https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
 ---
  SConstruct | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
@@ -12,15 +17,48 @@ diff --git a/SConstruct b/SConstruct
 index 05755e4b..3fbdc1d8 100644
 --- a/SConstruct
 +++ b/SConstruct
-@@ -537,7 +537,7 @@ env['mandir'] = Template( env.destdir + env['MANDIR'] ).safe_substitute( env )
+@@ -49,9 +49,10 @@
+     PathVariable( "BINDIR", "Overwrite the directory where apps are installed to.", "$PREFIX/bin", PathVariable.PathAccept ),
+     PathVariable( "LIBDIR", "Overwrite the directory where libs are installed to.", "$PREFIX/lib", PathVariable.PathAccept ),
+     PathVariable( "INCLUDEDIR", "Overwrite the directory where headers are installed to.", "$PREFIX/include", PathVariable.PathAccept ),
+-    PathVariable( "SHAREDIR", "Overwrite the directory where misc shared files are installed to.", "$PREFIX/share/libffado", PathVariable.PathAccept ),
++    PathVariable( "DATADIR", "Overwrite the directory where platform-independent files are installed to.", "$PREFIX/share", PathVariable.PathAccept ),
++    PathVariable( "SHAREDIR", "Overwrite the directory where misc shared files are installed to.", "$DATADIR/libffado", PathVariable.PathAccept ),
+     PathVariable( "LIBDATADIR", "Location for architecture-dependent data.", "$LIBDIR/libffado", PathVariable.PathAccept ),
+-    PathVariable( "MANDIR", "Overwrite the directory where manpages are installed", "$PREFIX/man", PathVariable.PathAccept ),
++    PathVariable( "MANDIR", "Overwrite the directory where manpages are installed", "$DATADIR/man", PathVariable.PathAccept ),
+     PathVariable( "PYPKGDIR", "The directory where the python modules get installed.",
+         distutils.sysconfig.get_python_lib( prefix="$PREFIX" ), PathVariable.PathAccept ),
+     PathVariable( "UDEVDIR", "Overwrite the directory where udev rules are installed to.", "/lib/udev/rules.d/", PathVariable.PathAccept ),
+@@ -523,6 +524,7 @@
+ env['BINDIR'] = Template( env['BINDIR'] ).safe_substitute( env )
+ env['LIBDIR'] = Template( env['LIBDIR'] ).safe_substitute( env )
+ env['INCLUDEDIR'] = Template( env['INCLUDEDIR'] ).safe_substitute( env )
++env['DATADIR'] = Template( env['DATADIR'] ).safe_substitute( env )
+ env['SHAREDIR'] = Template( env['SHAREDIR'] ).safe_substitute( env )
+ env['LIBDATADIR'] = Template( env['LIBDATADIR'] ).safe_substitute( env )
+ env['UDEVDIR'] = Template( env['UDEVDIR'] ).safe_substitute( env )
+@@ -531,18 +533,21 @@
+ env['bindir'] = Template( env.destdir + env['BINDIR'] ).safe_substitute( env )
+ env['libdir'] = Template( env.destdir + env['LIBDIR'] ).safe_substitute( env )
+ env['includedir'] = Template( env.destdir + env['INCLUDEDIR'] ).safe_substitute( env )
++env['datadir'] = Template( env.destdir + env['DATADIR'] ).safe_substitute( env )
+ env['sharedir'] = Template( env.destdir + env['SHAREDIR'] ).safe_substitute( env )
+ env['libdatadir'] = Template( env.destdir + env['LIBDATADIR'] ).safe_substitute( env )
+ env['mandir'] = Template( env.destdir + env['MANDIR'] ).safe_substitute( env )
  env['pypkgdir'] = Template( env.destdir + env['PYPKGDIR'] ).safe_substitute( env )
  env['udevdir'] = Template( env.destdir + env['UDEVDIR'] ).safe_substitute( env )
  env['PYPKGDIR'] = Template( env['PYPKGDIR'] ).safe_substitute( env )
 -env['metainfodir'] = Template( env.destdir + "/usr/share/metainfo" ).safe_substitute( env )
-+env['metainfodir'] = Template( env.destdir + env['SHAREDIR'] + "/metainfo" ).safe_substitute( env )
- 
+-
++env['metainfodir'] = Template( env.destdir + env['DATADIR'] + "/metainfo" ).safe_substitute( env )
++
++env.Command( target=env['datadir'], source="", action=Mkdir( env['datadir'] ) )
  env.Command( target=env['sharedir'], source="", action=Mkdir( env['sharedir'] ) )
  
--- 
-2.19.2
-
+ env.Alias( "install", env['libdir'] )
+ env.Alias( "install", env['includedir'] )
++env.Alias( "install", env['datadir'] )
+ env.Alias( "install", env['sharedir'] )
+ env.Alias( "install", env['libdatadir'] )
+ env.Alias( "install", env['bindir'] )
diff --git a/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix b/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
index 386df843971cf..b2125170db14d 100644
--- a/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
+++ b/pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix
@@ -2,22 +2,22 @@
 
 stdenvNoCC.mkDerivation {
   pname = "raspberrypi-wireless-firmware";
-  version = "unstable-2023-11-15";
+  version = "unstable-2024-02-26";
 
   srcs = [
     (fetchFromGitHub {
       name = "bluez-firmware";
       owner = "RPi-Distro";
       repo = "bluez-firmware";
-      rev = "d9d4741caba7314d6500f588b1eaa5ab387a4ff5";
-      hash = "sha256-CjbZ3t3TW/iJ3+t9QKEtM9NdQU7SwcUCDYuTmFEwvhU=";
+      rev = "78d6a07730e2d20c035899521ab67726dc028e1c";
+      hash = "sha256-KakKnOBeWxh0exu44beZ7cbr5ni4RA9vkWYb9sGMb8Q=";
     })
     (fetchFromGitHub {
       name = "firmware-nonfree";
       owner = "RPi-Distro";
       repo = "firmware-nonfree";
-      rev = "88aa085bfa1a4650e1ccd88896f8343c22a24055";
-      hash = "sha256-Yynww79LPPkau4YDSLI6IMOjH64nMpHUdGjnCfIR2+M=";
+      rev = "223ccf3a3ddb11b3ea829749fbbba4d65b380897";
+      hash = "sha256-BGq0+cr+xBRwQM/LqiQuRWuZpQsKM5jfcrNCqWMuVzM=";
     })
   ];
 
diff --git a/pkgs/os-specific/linux/firmware/raspberrypi/armstubs.nix b/pkgs/os-specific/linux/firmware/raspberrypi/armstubs.nix
index 72c6f6235548d..4ff7bf48b920c 100644
--- a/pkgs/os-specific/linux/firmware/raspberrypi/armstubs.nix
+++ b/pkgs/os-specific/linux/firmware/raspberrypi/armstubs.nix
@@ -48,6 +48,6 @@ stdenv.mkDerivation {
     homepage = "https://github.com/raspberrypi/tools";
     license = licenses.bsd3;
     platforms = [ "armv6l-linux" "armv7l-linux" "aarch64-linux" ];
-    maintainers = with maintainers; [ samueldr ];
+    maintainers = with maintainers; [ ];
   };
 }
diff --git a/pkgs/os-specific/linux/firmware/raspberrypi/default.nix b/pkgs/os-specific/linux/firmware/raspberrypi/default.nix
index 0aea94bca067f..ece39dade72b0 100644
--- a/pkgs/os-specific/linux/firmware/raspberrypi/default.nix
+++ b/pkgs/os-specific/linux/firmware/raspberrypi/default.nix
@@ -3,16 +3,13 @@
 stdenvNoCC.mkDerivation rec {
   # NOTE: this should be updated with linux_rpi
   pname = "raspberrypi-firmware";
-  # raspberrypi/firmware no longers tag the releases. However, since each commit
-  # on the stable branch corresponds to a tag in raspberrypi/linux repo, we
-  # assume they are cut together.
-  version = "stable_20231123";
+  version = "1.20240529";
 
   src = fetchFromGitHub {
     owner = "raspberrypi";
     repo = "firmware";
-    rev = "524247ac6d8b1f4ddd53730e978a70c76a320bd6";
-    hash = "sha256-rESwkR7pc5MTwIZ8PaMUPXuzxfv+jVpdRp8ijvxHGcg=";
+    rev = version;
+    hash = "sha256-KsCo7ZG6vKstxRyFljZtbQvnDSqiAPdUza32xTY/tlA=";
   };
 
   installPhase = ''
diff --git a/pkgs/os-specific/linux/firmware/zd1211/default.nix b/pkgs/os-specific/linux/firmware/zd1211/default.nix
index eb6276d36ac99..ecf131effd40a 100644
--- a/pkgs/os-specific/linux/firmware/zd1211/default.nix
+++ b/pkgs/os-specific/linux/firmware/zd1211/default.nix
@@ -24,7 +24,7 @@ stdenvNoCC.mkDerivation rec {
   meta = {
     description = "Firmware for the ZyDAS ZD1211(b) 802.11a/b/g USB WLAN chip";
     homepage = "https://sourceforge.net/projects/zd1211/";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/forkstat/default.nix b/pkgs/os-specific/linux/forkstat/default.nix
index 75ca64833a599..8454987343b0f 100644
--- a/pkgs/os-specific/linux/forkstat/default.nix
+++ b/pkgs/os-specific/linux/forkstat/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     description = "Process fork/exec/exit monitoring tool";
     mainProgram = "forkstat";
     homepage = "https://github.com/ColinIanKing/forkstat";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ womfoo ];
   };
diff --git a/pkgs/os-specific/linux/forktty/default.nix b/pkgs/os-specific/linux/forktty/default.nix
index 7dc1f0c3b2e4c..7240368861380 100644
--- a/pkgs/os-specific/linux/forktty/default.nix
+++ b/pkgs/os-specific/linux/forktty/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     description = "Tool to detach from controlling TTY and attach to another";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ raskin ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/framework-laptop-kmod/default.nix b/pkgs/os-specific/linux/framework-laptop-kmod/default.nix
index eddc5e272aaec..c31ce1b84b6b1 100644
--- a/pkgs/os-specific/linux/framework-laptop-kmod/default.nix
+++ b/pkgs/os-specific/linux/framework-laptop-kmod/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Kernel module that exposes the Framework Laptop (13, 16)'s battery charge limit and LEDs to userspace";
     homepage = "https://github.com/DHowett/framework-laptop-kmod";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ gaykitty ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/fswebcam/default.nix b/pkgs/os-specific/linux/fswebcam/default.nix
index 1f45d7955da49..08b1b9935291e 100644
--- a/pkgs/os-specific/linux/fswebcam/default.nix
+++ b/pkgs/os-specific/linux/fswebcam/default.nix
@@ -17,6 +17,6 @@ stdenv.mkDerivation rec {
     mainProgram = "fswebcam";
     homepage = "http://www.sanslogic.co.uk/fswebcam";
     platforms = lib.platforms.linux;
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
   };
 }
diff --git a/pkgs/os-specific/linux/fwts/default.nix b/pkgs/os-specific/linux/fwts/default.nix
index 5a06fac5d6c16..2d438a8a88c68 100644
--- a/pkgs/os-specific/linux/fwts/default.nix
+++ b/pkgs/os-specific/linux/fwts/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     homepage = "https://wiki.ubuntu.com/FirmwareTestSuite";
     description = "Firmware Test Suite";
     platforms = platforms.linux;
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ tadfisher ];
   };
 }
diff --git a/pkgs/os-specific/linux/g15daemon/default.nix b/pkgs/os-specific/linux/g15daemon/default.nix
index 8cd10899a3369..528b5e0993f54 100644
--- a/pkgs/os-specific/linux/g15daemon/default.nix
+++ b/pkgs/os-specific/linux/g15daemon/default.nix
@@ -4,7 +4,7 @@
 , libusb-compat-0_1
 }:
 let
-  license = lib.licenses.gpl2;
+  license = lib.licenses.gpl2Plus;
   maintainers = with lib.maintainers; [ peterhoeg ];
 
   g15src = { pname, version, sha256 }: fetchurl {
diff --git a/pkgs/os-specific/linux/gasket/default.nix b/pkgs/os-specific/linux/gasket/default.nix
index d3215bd668c5c..e8df9acf8e4b5 100644
--- a/pkgs/os-specific/linux/gasket/default.nix
+++ b/pkgs/os-specific/linux/gasket/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Coral Gasket Driver allows usage of the Coral EdgeTPU on Linux systems";
     homepage = "https://github.com/google/gasket-driver";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = [ lib.maintainers.kylehendricks ];
     platforms = platforms.linux;
     broken = versionOlder kernel.version "5.15";
diff --git a/pkgs/os-specific/linux/gcadapter-oc-kmod/default.nix b/pkgs/os-specific/linux/gcadapter-oc-kmod/default.nix
index 1f0265207dfbf..a1e3a8be430e5 100644
--- a/pkgs/os-specific/linux/gcadapter-oc-kmod/default.nix
+++ b/pkgs/os-specific/linux/gcadapter-oc-kmod/default.nix
@@ -31,7 +31,7 @@ in stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Kernel module for overclocking the Nintendo Wii U/Mayflash GameCube adapter";
     homepage = "https://github.com/HannesMann/gcadapter-oc-kmod";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ r-burns ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/gobi_loader/default.nix b/pkgs/os-specific/linux/gobi_loader/default.nix
index 2b251242119c8..2783e9f559b82 100644
--- a/pkgs/os-specific/linux/gobi_loader/default.nix
+++ b/pkgs/os-specific/linux/gobi_loader/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Firmware loader for Qualcomm Gobi USB chipsets";
     homepage = "https://www.codon.org.uk/~mjg59/gobi_loader/";
-    license = with licenses; [ gpl2 ];
+    license = with licenses; [ gpl2Only ];
     maintainers = with maintainers; [ _0x4A6F ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/gt/default.nix b/pkgs/os-specific/linux/gt/default.nix
index 9d35556358b5c..e5a6967579808 100644
--- a/pkgs/os-specific/linux/gt/default.nix
+++ b/pkgs/os-specific/linux/gt/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation (finalAttrs: {
     description = "Linux command line tool for setting up USB gadgets using configfs";
     mainProgram = "gt";
     license = with lib.licenses; [ asl20 ];
-    maintainers = with lib.maintainers; [ lheckemann ];
+    maintainers = with lib.maintainers; [ ];
     platforms = lib.platforms.linux;
   };
 })
diff --git a/pkgs/os-specific/linux/hdapsd/default.nix b/pkgs/os-specific/linux/hdapsd/default.nix
index e9dca6fd8927e..43700d20aa9aa 100644
--- a/pkgs/os-specific/linux/hdapsd/default.nix
+++ b/pkgs/os-specific/linux/hdapsd/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     { description = "Hard Drive Active Protection System Daemon";
       mainProgram = "hdapsd";
       homepage = "http://hdaps.sf.net/";
-      license = licenses.gpl2;
+      license = licenses.gpl2Plus;
       platforms = platforms.linux;
       maintainers = [ maintainers.ehmry ];
     };
diff --git a/pkgs/os-specific/linux/health-check/default.nix b/pkgs/os-specific/linux/health-check/default.nix
index e63b7ca7fe258..e55433c0a70bd 100644
--- a/pkgs/os-specific/linux/health-check/default.nix
+++ b/pkgs/os-specific/linux/health-check/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     description = "Process monitoring tool";
     mainProgram = "health-check";
     homepage = "https://github.com/ColinIanKing/health-check";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ dtzWill ];
   };
diff --git a/pkgs/os-specific/linux/hostapd/default.nix b/pkgs/os-specific/linux/hostapd/default.nix
index 7e89feaa6514f..1187cd2194570 100644
--- a/pkgs/os-specific/linux/hostapd/default.nix
+++ b/pkgs/os-specific/linux/hostapd/default.nix
@@ -104,7 +104,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://w1.fi/hostapd/";
     description = "User space daemon for access point and authentication servers";
-    license = licenses.gpl2;
+    license = licenses.bsd3;
     maintainers = with maintainers; [ ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/hwdata/default.nix b/pkgs/os-specific/linux/hwdata/default.nix
index 320f10d551380..484e63bb357c9 100644
--- a/pkgs/os-specific/linux/hwdata/default.nix
+++ b/pkgs/os-specific/linux/hwdata/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   pname = "hwdata";
-  version = "0.382";
+  version = "0.383";
 
   src = fetchFromGitHub {
     owner = "vcrhonek";
     repo = "hwdata";
     rev = "v${version}";
-    hash = "sha256-j7ITcLilcnV8QCUFC/Ybv1dX6Kl36P0G9vBlrzifhFQ=";
+    hash = "sha256-jYD1/sl9ffe+lmrICLe32NU1u0Hi7ZfZrD4zWH+bxsk=";
   };
 
   configureFlags = [ "--datadir=${placeholder "out"}/share" ];
diff --git a/pkgs/os-specific/linux/i7z/default.nix b/pkgs/os-specific/linux/i7z/default.nix
index 7f2b2d5d0a594..5a7279ba998cb 100644
--- a/pkgs/os-specific/linux/i7z/default.nix
+++ b/pkgs/os-specific/linux/i7z/default.nix
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
     description = "Better i7 (and now i3, i5) reporting tool for Linux";
     mainProgram = "i7z";
     homepage = "https://github.com/DimitryAndric/i7z";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ bluescreen303 ];
     # broken on ARM
     platforms = [ "x86_64-linux" ];
diff --git a/pkgs/os-specific/linux/i810switch/default.nix b/pkgs/os-specific/linux/i810switch/default.nix
index ab3fa970d380a..a5e24b1eb2936 100644
--- a/pkgs/os-specific/linux/i810switch/default.nix
+++ b/pkgs/os-specific/linux/i810switch/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
     description = "Utility for switching between the LCD and external VGA display on Intel graphics cards";
     homepage = "http://www16.plala.or.jp/mano-a-mano/i810switch.html";
     maintainers = with maintainers; [ ];
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ifenslave/default.nix b/pkgs/os-specific/linux/ifenslave/default.nix
index cc132c69faf71..8aeeff77ecbb7 100644
--- a/pkgs/os-specific/linux/ifenslave/default.nix
+++ b/pkgs/os-specific/linux/ifenslave/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Utility for enslaving networking interfaces under a bond";
     mainProgram = "ifenslave";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ima-evm-utils/default.nix b/pkgs/os-specific/linux/ima-evm-utils/default.nix
index fa90ceecdb2b1..5960e49e78250 100644
--- a/pkgs/os-specific/linux/ima-evm-utils/default.nix
+++ b/pkgs/os-specific/linux/ima-evm-utils/default.nix
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
     description = "evmctl utility to manage digital signatures of the Linux kernel integrity subsystem (IMA/EVM)";
     mainProgram = "evmctl";
     homepage = "https://sourceforge.net/projects/linux-ima/";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     platforms = lib.platforms.linux;
     maintainers = with lib.maintainers; [ nickcao ];
   };
diff --git a/pkgs/os-specific/linux/input-utils/default.nix b/pkgs/os-specific/linux/input-utils/default.nix
deleted file mode 100644
index 36a203a47c76b..0000000000000
--- a/pkgs/os-specific/linux/input-utils/default.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ lib, stdenv, fetchurl, linuxHeaders }:
-
-stdenv.mkDerivation rec {
-  pname = "input-utils";
-  version = "1.3";
-
-  src = fetchurl {
-    url = "https://www.kraxel.org/releases/input/input-${version}.tar.gz";
-    sha256 = "11w0pp20knx6qpgzmawdbk1nj2z3fzp8yd6nag6s8bcga16w6hli";
-  };
-
-  prePatch = ''
-    # Use proper include path for kernel include files.
-    substituteInPlace ./name.sh --replace "/usr/include/linux/" "${linuxHeaders}/include/linux/"
-    substituteInPlace ./lirc.sh --replace "/usr/include/linux/" "${linuxHeaders}/include/linux/"
-  '';
-
-  makeFlags = [
-    "prefix=$(out)"
-    "STRIP="
-  ];
-
-  meta = with lib; {
-    description = "Input layer utilities, includes lsinput";
-    homepage    = "https://www.kraxel.org/blog/linux/input/";
-    license     = licenses.gpl2;
-    maintainers = with maintainers; [ samueldr ];
-    platforms   = platforms.linux;
-  };
-}
diff --git a/pkgs/os-specific/linux/intel-speed-select/default.nix b/pkgs/os-specific/linux/intel-speed-select/default.nix
index 9d9c9b134c64e..97bfdbeb30d5c 100644
--- a/pkgs/os-specific/linux/intel-speed-select/default.nix
+++ b/pkgs/os-specific/linux/intel-speed-select/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
     description = "Tool to enumerate and control the Intel Speed Select Technology features";
     mainProgram = "intel-speed-select";
     homepage = "https://www.kernel.org/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = [ "i686-linux" "x86_64-linux" ]; # x86-specific
     broken = kernel.kernelAtLeast "5.18";
   };
diff --git a/pkgs/os-specific/linux/iotop/default.nix b/pkgs/os-specific/linux/iotop/default.nix
index 496ff7f115377..767bf4a2915ce 100644
--- a/pkgs/os-specific/linux/iotop/default.nix
+++ b/pkgs/os-specific/linux/iotop/default.nix
@@ -21,7 +21,7 @@ python3Packages.buildPythonApplication rec {
   meta = with lib; {
     description = "Tool to find out the processes doing the most IO";
     homepage = "http://guichaz.free.fr/iotop";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     mainProgram = "iotop";
     maintainers = [ maintainers.raskin ];
     platforms = platforms.linux;
diff --git a/pkgs/os-specific/linux/iproute/default.nix b/pkgs/os-specific/linux/iproute/default.nix
index 3cc7759b41830..15b8987b8cc05 100644
--- a/pkgs/os-specific/linux/iproute/default.nix
+++ b/pkgs/os-specific/linux/iproute/default.nix
@@ -6,17 +6,14 @@
 
 stdenv.mkDerivation rec {
   pname = "iproute2";
-  version = "6.8.0";
+  version = "6.9.0";
 
   src = fetchurl {
     url = "mirror://kernel/linux/utils/net/${pname}/${pname}-${version}.tar.xz";
-    hash = "sha256-A6bMo9cakI0fFfe0lb4rj+hR+UFFjcRmSQDX9F/PaM4=";
+    hash = "sha256-L2Q9CeoRpKKgQ8kuK0abX3MijL8kGugGdgKW7Q7EE9A=";
   };
 
   postPatch = ''
-    # Don't try to create /var/lib/arpd:
-    sed -e '/ARPDDIR/d' -i Makefile
-
     substituteInPlace Makefile \
       --replace "CC := gcc" "CC ?= $CC"
   '';
@@ -66,7 +63,7 @@ stdenv.mkDerivation rec {
     homepage = "https://wiki.linuxfoundation.org/networking/iproute2";
     description = "Collection of utilities for controlling TCP/IP networking and traffic control in Linux";
     platforms = platforms.linux;
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ primeos eelco fpletz globin ];
   };
 }
diff --git a/pkgs/os-specific/linux/ipset/default.nix b/pkgs/os-specific/linux/ipset/default.nix
index 4b8fadcecf25c..94a5a43b76e19 100644
--- a/pkgs/os-specific/linux/ipset/default.nix
+++ b/pkgs/os-specific/linux/ipset/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://ipset.netfilter.org/";
     description = "Administration tool for IP sets";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/iptables/default.nix b/pkgs/os-specific/linux/iptables/default.nix
index 2efa609518256..afaa91ca2f37e 100644
--- a/pkgs/os-specific/linux/iptables/default.nix
+++ b/pkgs/os-specific/linux/iptables/default.nix
@@ -54,7 +54,7 @@ stdenv.mkDerivation rec {
     homepage = "https://www.netfilter.org/projects/iptables/index.html";
     platforms = platforms.linux;
     maintainers = with maintainers; [ fpletz ];
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     downloadPage = "https://www.netfilter.org/projects/iptables/files/";
   };
 }
diff --git a/pkgs/os-specific/linux/ipu6-drivers/default.nix b/pkgs/os-specific/linux/ipu6-drivers/default.nix
index 276926fef8aa6..cb1cf06b530e9 100644
--- a/pkgs/os-specific/linux/ipu6-drivers/default.nix
+++ b/pkgs/os-specific/linux/ipu6-drivers/default.nix
@@ -44,7 +44,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://github.com/intel/ipu6-drivers";
     description = "IPU6 kernel driver";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     maintainers = with lib.maintainers; [ ];
     platforms = [ "x86_64-linux" ];
     # requires 6.1.7 https://github.com/intel/ipu6-drivers/pull/84
diff --git a/pkgs/os-specific/linux/iputils/default.nix b/pkgs/os-specific/linux/iputils/default.nix
index aa83a91216b69..1be7debb895cc 100644
--- a/pkgs/os-specific/linux/iputils/default.nix
+++ b/pkgs/os-specific/linux/iputils/default.nix
@@ -79,6 +79,6 @@ stdenv.mkDerivation rec {
     '';
     license = with licenses; [ gpl2Plus bsd3 ];
     platforms = platforms.linux;
-    maintainers = with maintainers; [ primeos lheckemann ];
+    maintainers = with maintainers; [ primeos ];
   };
 }
diff --git a/pkgs/os-specific/linux/ipvsadm/default.nix b/pkgs/os-specific/linux/ipvsadm/default.nix
index c988167469188..c6447e9a9b578 100644
--- a/pkgs/os-specific/linux/ipvsadm/default.nix
+++ b/pkgs/os-specific/linux/ipvsadm/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Linux Virtual Server support programs";
     homepage = "http://www.linuxvirtualserver.org/software/ipvs.html";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ivsc-driver/default.nix b/pkgs/os-specific/linux/ivsc-driver/default.nix
index 5612c9170abd4..1308ff5f37cf4 100644
--- a/pkgs/os-specific/linux/ivsc-driver/default.nix
+++ b/pkgs/os-specific/linux/ivsc-driver/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://github.com/intel/ivsc-driver";
     description = "Intel Vision Sensing Controller kernel driver";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     maintainers = with lib.maintainers; [ ];
     platforms = [ "x86_64-linux" ];
     broken = kernel.kernelOlder "5.15";
diff --git a/pkgs/os-specific/linux/ixgbevf/default.nix b/pkgs/os-specific/linux/ixgbevf/default.nix
index 6a748c4701903..3cb9d06e7fcf4 100644
--- a/pkgs/os-specific/linux/ixgbevf/default.nix
+++ b/pkgs/os-specific/linux/ixgbevf/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Intel 82599 Virtual Function Driver";
     homepage = "https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     priority = 20;
     # kernels ship ixgbevf driver for a long time already, maybe switch to a newest kernel?
     broken = versionAtLeast kernel.version "5.2";
diff --git a/pkgs/os-specific/linux/jool/cli.nix b/pkgs/os-specific/linux/jool/cli.nix
index ee5ee1128a867..904bb7366f7e2 100644
--- a/pkgs/os-specific/linux/jool/cli.nix
+++ b/pkgs/os-specific/linux/jool/cli.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation {
     homepage = "https://www.jool.mx/";
     description = "Fairly compliant SIIT and Stateful NAT64 for Linux - CLI tools";
     platforms = platforms.linux;
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ fpletz ];
   };
 }
diff --git a/pkgs/os-specific/linux/jujuutils/default.nix b/pkgs/os-specific/linux/jujuutils/default.nix
index 12e4c15e62c0b..8c5dabf66a900 100644
--- a/pkgs/os-specific/linux/jujuutils/default.nix
+++ b/pkgs/os-specific/linux/jujuutils/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://github.com/cladisch/linux-firewire-utils";
     description = "Utilities around FireWire devices connected to a Linux computer";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix
index fc2f8ddbd1434..450e26b4eca17 100644
--- a/pkgs/os-specific/linux/kernel-headers/default.nix
+++ b/pkgs/os-specific/linux/kernel-headers/default.nix
@@ -104,19 +104,19 @@ let
 
     meta = with lib; {
       description = "Header files and scripts for Linux kernel";
-      license = licenses.gpl2;
+      license = licenses.gpl2Only;
       platforms = platforms.linux;
     };
   };
 in {
   inherit makeLinuxHeaders;
 
-  linuxHeaders = let version = "6.7"; in
+  linuxHeaders = let version = "6.9"; in
     makeLinuxHeaders {
       inherit version;
       src = fetchurl {
         url = "mirror://kernel/linux/kernel/v${lib.versions.major version}.x/linux-${version}.tar.xz";
-        hash = "sha256-7zEUSiV20IDYwxaY6D7J9mv5fGd/oqrw1bu58zRbEGk=";
+        hash = "sha256-JPoB+5icej4oRT8Rd5kWhxN2bhGcU4HawwEV8Y8mgUk=";
       };
       patches = [
         ./no-relocs.patch # for building x86 kernel headers on non-ELF platforms
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index c9bf296160629..41d766de48b46 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -327,6 +327,10 @@ let
       INET_RAW_DIAG     = mkDefault module;
       INET_DIAG_DESTROY = mkDefault yes;
 
+      # IPsec over TCP
+      INET_ESPINTCP  = whenAtLeast "5.8" yes;
+      INET6_ESPINTCP = whenAtLeast "5.8" yes;
+
       # enable multipath-tcp
       MPTCP           = whenAtLeast "5.6" yes;
       MPTCP_IPV6      = whenAtLeast "5.6" yes;
@@ -667,20 +671,29 @@ let
     };
 
     security = {
+      # Report BUG() conditions and kill the offending process.
+      BUG = yes;
+      BUG_ON_DATA_CORRUPTION = yes;
+
       FORTIFY_SOURCE                   = option yes;
 
       # https://googleprojectzero.blogspot.com/2019/11/bad-binder-android-in-wild-exploit.html
       DEBUG_LIST                       = yes;
+
       HARDENED_USERCOPY                = yes;
       RANDOMIZE_BASE                   = option yes;
+      STRICT_KERNEL_RWX                = yes;
+      STRICT_MODULE_RWX                = yes;
       STRICT_DEVMEM                    = mkDefault yes; # Filter access to /dev/mem
       IO_STRICT_DEVMEM                 = mkDefault yes;
       SECURITY_SELINUX_BOOTPARAM_VALUE = whenOlder "5.1" (freeform "0"); # Disable SELinux by default
+
       # Prevent processes from ptracing non-children processes
       SECURITY_YAMA                    = option yes;
       # The goal of Landlock is to enable to restrict ambient rights (e.g. global filesystem access) for a set of processes.
       # This does not have any effect if a program does not support it
       SECURITY_LANDLOCK                = whenAtLeast "5.13" yes;
+
       DEVKMEM                          = whenOlder "5.13" no; # Disable /dev/kmem
 
       USER_NS                          = yes; # Support for user namespaces
@@ -715,6 +728,10 @@ let
 
       # Enable support for page poisoning. Still needs to be enabled on the command line to actually work.
       PAGE_POISONING                   = yes;
+      # Randomize page allocator when page_alloc.shuffle=1
+      SHUFFLE_PAGE_ALLOCATOR = whenAtLeast "5.2" yes;
+
+      INIT_ON_ALLOC_DEFAULT_ON = whenAtLeast "5.3" yes;
 
       # Enable stack smashing protections in schedule()
       # See: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.8&id=0d9e26329b0c9263d4d9e0422d80a0e73268c52f
@@ -739,6 +756,10 @@ let
       # Mitigate straight line speculation at the cost of some file size
       SLS = whenBetween "5.17" "6.9" yes;
       MITIGATION_SLS = whenAtLeast "6.9" yes;
+
+      DEFAULT_MMAP_MIN_ADDR = freeform "65536";
+    } // optionalAttrs stdenv.hostPlatform.isAarch64 {
+      DEFAULT_MMAP_MIN_ADDR = freeform "32768";
     };
 
     microcode = {
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index 37c138402d006..5981de6732426 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -97,7 +97,7 @@ let
   # For further context, see https://github.com/NixOS/nixpkgs/pull/143113#issuecomment-953319957
   basicArgs = builtins.removeAttrs
     args
-    (lib.filter (x: ! (builtins.elem x [ "version" "src" ])) (lib.attrNames args));
+    (lib.filter (x: ! (builtins.elem x [ "version" "pname" "src" ])) (lib.attrNames args));
 
   # Combine the `features' attribute sets of all the kernel patches.
   kernelFeatures = lib.foldr (x: y: (x.features or {}) // y) ({
@@ -140,8 +140,7 @@ let
     passAsFile = [ "kernelConfig" ];
 
     depsBuildBuild = [ buildPackages.stdenv.cc ];
-    nativeBuildInputs = [ perl gmp libmpc mpfr ]
-      ++ lib.optionals (lib.versionAtLeast version "4.16") [ bison flex ]
+    nativeBuildInputs = [ perl gmp libmpc mpfr bison flex ]
       ++ lib.optional (lib.versionAtLeast version "5.2") pahole
       ++ lib.optionals withRust [ rust-bindgen rustc ]
     ;
diff --git a/pkgs/os-specific/linux/kernel/gpio-utils.nix b/pkgs/os-specific/linux/kernel/gpio-utils.nix
index 40e282bbf541d..dc8f88b5769f7 100644
--- a/pkgs/os-specific/linux/kernel/gpio-utils.nix
+++ b/pkgs/os-specific/linux/kernel/gpio-utils.nix
@@ -19,6 +19,6 @@ stdenv.mkDerivation {
     description = "Linux tools to inspect the gpiochip interface";
     maintainers = with maintainers; [ kwohlfahrt ];
     platforms = platforms.linux;
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
   };
 }
diff --git a/pkgs/os-specific/linux/kernel/hardened/config.nix b/pkgs/os-specific/linux/kernel/hardened/config.nix
index d687366dbe2f8..0ab89d23952db 100644
--- a/pkgs/os-specific/linux/kernel/hardened/config.nix
+++ b/pkgs/os-specific/linux/kernel/hardened/config.nix
@@ -17,9 +17,6 @@ with (lib.kernel.whenHelpers version);
 assert (versionAtLeast version "4.9");
 
 {
-  # Report BUG() conditions and kill the offending process.
-  BUG = yes;
-
   # Mark LSM hooks read-only after init.  SECURITY_WRITABLE_HOOKS n
   # conflicts with SECURITY_SELINUX_DISABLE y; disabling the latter
   # implicitly marks LSM hooks read-only after init.
@@ -31,8 +28,6 @@ assert (versionAtLeast version "4.9");
   SECURITY_SELINUX_DISABLE = whenOlder "6.4" no; # On 6.4: error: unused option: SECURITY_SELINUX_DISABLE
   SECURITY_WRITABLE_HOOKS  = option no;
 
-  STRICT_KERNEL_RWX = yes;
-
   # Perform additional validation of commonly targeted structures.
   DEBUG_CREDENTIALS     = whenOlder "6.6" yes;
   DEBUG_NOTIFIERS       = yes;
@@ -51,16 +46,11 @@ assert (versionAtLeast version "4.9");
   # restricts loading of line disciplines via TIOCSETD ioctl to CAP_SYS_MODULE
   CONFIG_LDISC_AUTOLOAD = option no;
 
-  # Randomize page allocator when page_alloc.shuffle=1
-  SHUFFLE_PAGE_ALLOCATOR = whenAtLeast "5.2" yes;
-
   # Wipe higher-level memory allocations on free() with page_poison=1
-  PAGE_POISONING           = yes;
   PAGE_POISONING_NO_SANITY = whenOlder "5.11" yes;
   PAGE_POISONING_ZERO      = whenOlder "5.11" yes;
 
-  # Enable init_on_alloc and init_on_free by default
-  INIT_ON_ALLOC_DEFAULT_ON = whenAtLeast "5.3" yes;
+  # Enable init_on_free by default
   INIT_ON_FREE_DEFAULT_ON  = whenAtLeast "5.3" yes;
 
   # Wipe all caller-used registers on exit from a function
@@ -113,9 +103,6 @@ assert (versionAtLeast version "4.9");
   CC_STACKPROTECTOR_REGULAR = lib.mkForce (whenOlder "4.18" no);
   CC_STACKPROTECTOR_STRONG  = whenOlder "4.18" yes;
 
-  # Detect out-of-bound reads/writes and use-after-free
-  KFENCE = whenAtLeast "5.12" yes;
-
   # CONFIG_DEVMEM=n causes these to not exist anymore.
   STRICT_DEVMEM    = option no;
   IO_STRICT_DEVMEM = option no;
@@ -126,8 +113,4 @@ assert (versionAtLeast version "4.9");
 
   # not needed for less than a decade old glibc versions
   LEGACY_VSYSCALL_NONE = yes;
-
-  # Straight-Line-Speculation
-  # https://lwn.net/Articles/877845/
-  SLS = option yes;
 }
diff --git a/pkgs/os-specific/linux/kernel/kernels-org.json b/pkgs/os-specific/linux/kernel/kernels-org.json
index b1b6ce38c83b8..4722c0a64a057 100644
--- a/pkgs/os-specific/linux/kernel/kernels-org.json
+++ b/pkgs/os-specific/linux/kernel/kernels-org.json
@@ -1,38 +1,38 @@
 {
     "testing": {
-        "version": "6.10-rc3",
-        "hash": "sha256:11kjvjww4n0l4knq1v4rsbnac4s01r69yk1lrb9hgikszxyjklwk"
+        "version": "6.10-rc4",
+        "hash": "sha256:1cx7c25fa8pvabhwph0rdqdryalxgl7rs1ry0v4k048bxpisvahf"
     },
     "6.1": {
-        "version": "6.1.92",
-        "hash": "sha256:1j9n8gk76nn4gw42iba5zgghr360gb9n1mslr5dyv76wpwkz86ch"
+        "version": "6.1.95",
+        "hash": "sha256:1gfz2j6iixbr0dfkb8jkwnb4gicrm5rc5lsa24wmyrkm3nmg0q19"
     },
     "5.15": {
-        "version": "5.15.160",
-        "hash": "sha256:018v19a7rhzc4szybzzn86jlnk42x7jm6xkadfd2d3xq6f7727pl"
+        "version": "5.15.161",
+        "hash": "sha256:0k277hz6nq62v0xfc1n2hc69cyvmnxpl0qcbszinajywh23gfafn"
     },
     "5.10": {
-        "version": "5.10.218",
-        "hash": "sha256:1mmj5hwm5i16gc1y4nzr1cs882vi6vrihrincdcivv63x11v4dlw"
+        "version": "5.10.220",
+        "hash": "sha256:16z1xqm7djm8pl15s5wvgc4pwq81gydcf00jpxfplw794kwszhvw"
     },
     "5.4": {
-        "version": "5.4.277",
-        "hash": "sha256:0l8zq3k07hdprfpvw69ykkf2pdg8wiv28xz733yxsjcfb0l5n7vy"
+        "version": "5.4.278",
+        "hash": "sha256:1245zf7vk2fyprw9fspljqy9wlzma9bayri7xx2g8iam2430d875"
     },
     "4.19": {
-        "version": "4.19.315",
-        "hash": "sha256:1j1j8awy0237jp2r211qpa305c10y7rlcbkxkzdvzbgyhwy4spkc"
+        "version": "4.19.316",
+        "hash": "sha256:0lmyhwr4la7kvim7jqdi29scjkvqp9crpvdbhpb4j8d7mj5kgzz4"
     },
     "6.6": {
-        "version": "6.6.32",
-        "hash": "sha256:1qbc8dqmk2xs1cz968rysw5xvhq3lj8g0pxp48fr2qbzy3m29a5a"
+        "version": "6.6.35",
+        "hash": "sha256:17nxymy3r9q45cfzc9rqp937m37zr1b8fjn1m0x0dv8jhxrfxqzw"
     },
     "6.8": {
         "version": "6.8.12",
         "hash": "sha256:0fb0m0fv4521g63gq04d7lm6hy8169s1rykiav5bkd99s9b1kcqr"
     },
     "6.9": {
-        "version": "6.9.3",
-        "hash": "sha256:1bnzxparybwh320019pr2msaapas41dhjmvg4gy791rn05jc88f3"
+        "version": "6.9.6",
+        "hash": "sha256:0jvbv5g9xx76a4ni0b66gzj5i2y77gpmfdg0mdsg564rp3i6chsx"
     }
 }
diff --git a/pkgs/os-specific/linux/kernel/linux-libre.nix b/pkgs/os-specific/linux/kernel/linux-libre.nix
index 4bb2ebda3d028..b5be3ba7230a9 100644
--- a/pkgs/os-specific/linux/kernel/linux-libre.nix
+++ b/pkgs/os-specific/linux/kernel/linux-libre.nix
@@ -1,8 +1,8 @@
 { stdenv, lib, fetchsvn, linux
 , scripts ? fetchsvn {
     url = "https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/branches/";
-    rev = "19575";
-    sha256 = "1f826x8a6nmqcjcplg5x4rcqkr3p886abxhyqir8a102ymnh7wkw";
+    rev = "19584";
+    sha256 = "1vhk4jnx8f98lkj2isrms2jm9c5qrpgayxbhawslqrprq1pmzlif";
   }
 , ...
 }:
@@ -23,6 +23,7 @@ in linux.override {
   argsOverride = {
     modDirVersion = "${linux.modDirVersion}-${versionPrefix}";
     isLibre = true;
+    pname = "linux-libre";
 
     src = stdenv.mkDerivation {
       name = "${linux.name}-libre-src";
diff --git a/pkgs/os-specific/linux/kernel/linux-rpi.nix b/pkgs/os-specific/linux/kernel/linux-rpi.nix
index f1449998984be..775a50980f6d4 100644
--- a/pkgs/os-specific/linux/kernel/linux-rpi.nix
+++ b/pkgs/os-specific/linux/kernel/linux-rpi.nix
@@ -2,18 +2,19 @@
 
 let
   # NOTE: raspberrypifw & raspberryPiWirelessFirmware should be updated with this
-  modDirVersion = "6.1.63";
-  tag = "stable_20231123";
+  modDirVersion = "6.6.31";
+  tag = "stable_20240529";
 in
 lib.overrideDerivation (buildLinux (args // {
   version = "${modDirVersion}-${tag}";
   inherit modDirVersion;
+  pname = "linux-rpi";
 
   src = fetchFromGitHub {
     owner = "raspberrypi";
     repo = "linux";
     rev = tag;
-    hash = "sha256-4Rc57y70LmRFwDnOD4rHoHGmfxD9zYEAwYm9Wvyb3no=";
+    hash = "sha256-UWUTeCpEN7dlFSQjog6S3HyEWCCnaqiUqV5KxCjYink=";
   };
 
   defconfig = {
@@ -23,32 +24,33 @@ lib.overrideDerivation (buildLinux (args // {
     "4" = "bcm2711_defconfig";
   }.${toString rpiVersion};
 
+  structuredExtraConfig = (args.structuredExtraConfig or {}) // (with lib.kernel; {
+    # Workaround https://github.com/raspberrypi/linux/issues/6198
+    # Needed because NixOS 24.05+ sets DRM_SIMPLEDRM=y which pulls in
+    # DRM_KMS_HELPER=y.
+    BACKLIGHT_CLASS_DEVICE = yes;
+  });
+
   features = {
     efiBootStub = false;
   } // (args.features or {});
 
   kernelPatches = (args.kernelPatches or []) ++ [
-    # Fix "WARNING: unmet direct dependencies detected for MFD_RP1", and
-    # subsequent build failure.
-    # https://github.com/NixOS/nixpkgs/pull/268280#issuecomment-1911839809
-    # https://github.com/raspberrypi/linux/pull/5900
+    # Fix compilation errors due to incomplete patch backport.
+    # https://github.com/raspberrypi/linux/pull/6223
     {
-      name = "drm-rp1-depends-on-instead-of-select-MFD_RP1.patch";
+      name = "gpio-pwm_-_pwm_apply_might_sleep.patch";
       patch = fetchpatch {
-        url = "https://github.com/peat-psuwit/rpi-linux/commit/6de0bb51929cd3ad4fa27b2a421a2af12e6468f5.patch";
-        hash = "sha256-9pHcbgWTiztu48SBaLPVroUnxnXMKeCGt5vEo9V8WGw=";
+        url = "https://github.com/peat-psuwit/rpi-linux/commit/879f34b88c60dd59765caa30576cb5bfb8e73c56.patch";
+        hash = "sha256-HlOkM9EFmlzOebCGoj7lNV5hc0wMjhaBFFZvaRCI0lI=";
       };
     }
 
-    # Fix `ERROR: modpost: missing MODULE_LICENSE() in <...>/bcm2712-iommu.o`
-    # by preventing such code from being built as module.
-    # https://github.com/NixOS/nixpkgs/pull/284035#issuecomment-1913015802
-    # https://github.com/raspberrypi/linux/pull/5910
     {
-      name = "iommu-bcm2712-don-t-allow-building-as-module.patch";
+      name = "ir-rx51_-_pwm_apply_might_sleep.patch";
       patch = fetchpatch {
-        url = "https://github.com/peat-psuwit/rpi-linux/commit/693a5e69bddbcbe1d1b796ebc7581c3597685b1b.patch";
-        hash = "sha256-8BYYQDM5By8cTk48ASYKJhGVQnZBIK4PXtV70UtfS+A=";
+        url = "https://github.com/peat-psuwit/rpi-linux/commit/23431052d2dce8084b72e399fce82b05d86b847f.patch";
+        hash = "sha256-UDX/BJCJG0WVndP/6PbPK+AZsfU3vVxDCrpn1kb1kqE=";
       };
     }
   ];
diff --git a/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix b/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix
index d2cc98b8159dc..ec7f104bcb1d2 100644
--- a/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix
+++ b/pkgs/os-specific/linux/kernel/linux-rt-5.10.nix
@@ -6,25 +6,26 @@
 , ... } @ args:
 
 let
-  version = "5.10.217-rt109"; # updated by ./update-rt.sh
+  version = "5.10.218-rt110"; # updated by ./update-rt.sh
   branch = lib.versions.majorMinor version;
   kversion = builtins.elemAt (lib.splitString "-" version) 0;
 in buildLinux (args // {
   inherit version;
+  pname = "linux-rt";
 
   # modDirVersion needs a patch number, change X.Y-rtZ to X.Y.0-rtZ.
   modDirVersion = lib.versions.pad 3 version;
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v5.x/linux-${kversion}.tar.xz";
-    sha256 = "0qhzqrjci45vcbzjch7vq75i6hpyap6yb7jw6g71phcnqgzw2ay5";
+    sha256 = "1mmj5hwm5i16gc1y4nzr1cs882vi6vrihrincdcivv63x11v4dlw";
   };
 
   kernelPatches = let rt-patch = {
     name = "rt";
     patch = fetchurl {
       url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz";
-      sha256 = "1cszl9414vbycswx2gjv12wdghhw5s6amd9mjmx619r2a1r0gnb7";
+      sha256 = "0zam7hlcrphxv53jcza7sw0lv8a9mz15cl35adwb2rd2y1x9nhad";
     };
   }; in [ rt-patch ] ++ kernelPatches;
 
diff --git a/pkgs/os-specific/linux/kernel/linux-rt-5.15.nix b/pkgs/os-specific/linux/kernel/linux-rt-5.15.nix
index 5e43eca364d42..127d7e6635138 100644
--- a/pkgs/os-specific/linux/kernel/linux-rt-5.15.nix
+++ b/pkgs/os-specific/linux/kernel/linux-rt-5.15.nix
@@ -6,11 +6,12 @@
 , ... } @ args:
 
 let
-  version = "5.15.158-rt76"; # updated by ./update-rt.sh
+  version = "5.15.160-rt77"; # updated by ./update-rt.sh
   branch = lib.versions.majorMinor version;
   kversion = builtins.elemAt (lib.splitString "-" version) 0;
 in buildLinux (args // {
   inherit version;
+  pname = "linux-rt";
 
   # modDirVersion needs a patch number, change X.Y-rtZ to X.Y.0-rtZ.
   modDirVersion = if (builtins.match "[^.]*[.][^.]*-.*" version) == null then version
@@ -18,14 +19,14 @@ in buildLinux (args // {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v5.x/linux-${kversion}.tar.xz";
-    sha256 = "1inmdpif3qf1blmvjj4i7y42bylvhv0wyj3b0apq12zxlj1iq1zr";
+    sha256 = "018v19a7rhzc4szybzzn86jlnk42x7jm6xkadfd2d3xq6f7727pl";
   };
 
   kernelPatches = let rt-patch = {
     name = "rt";
     patch = fetchurl {
       url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz";
-      sha256 = "17kw7cs1p0qgqf911prn3472c1j7r01g0mzqxsxpkdvhawxps7wy";
+      sha256 = "0id4m1k1xq84bxgnchm8r2iwfqw6nacv5n1ksgyzj6q6v66ik3wk";
     };
   }; in [ rt-patch ] ++ kernelPatches;
 
diff --git a/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix b/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix
index 463385036292e..2fc18c76e5706 100644
--- a/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix
+++ b/pkgs/os-specific/linux/kernel/linux-rt-5.4.nix
@@ -11,6 +11,7 @@ let
   kversion = builtins.elemAt (lib.splitString "-" version) 0;
 in buildLinux (args // {
   inherit version;
+  pname = "linux-rt";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v5.x/linux-${kversion}.tar.xz";
diff --git a/pkgs/os-specific/linux/kernel/linux-rt-6.1.nix b/pkgs/os-specific/linux/kernel/linux-rt-6.1.nix
index f7f21a71263bd..a515cc1924fd9 100644
--- a/pkgs/os-specific/linux/kernel/linux-rt-6.1.nix
+++ b/pkgs/os-specific/linux/kernel/linux-rt-6.1.nix
@@ -6,11 +6,12 @@
 , ... } @ args:
 
 let
-  version = "6.1.92-rt32"; # updated by ./update-rt.sh
+  version = "6.1.94-rt33"; # updated by ./update-rt.sh
   branch = lib.versions.majorMinor version;
   kversion = builtins.elemAt (lib.splitString "-" version) 0;
 in buildLinux (args // {
   inherit version;
+  pname = "linux-rt";
 
   # modDirVersion needs a patch number, change X.Y-rtZ to X.Y.0-rtZ.
   modDirVersion = if (builtins.match "[^.]*[.][^.]*-.*" version) == null then version
@@ -18,14 +19,14 @@ in buildLinux (args // {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v6.x/linux-${kversion}.tar.xz";
-    sha256 = "1j9n8gk76nn4gw42iba5zgghr360gb9n1mslr5dyv76wpwkz86ch";
+    sha256 = "0sakp5k4q2xfd3la7j8s2rcbvndh6fdqgzz5ivyqf0df4anp3siq";
   };
 
   kernelPatches = let rt-patch = {
     name = "rt";
     patch = fetchurl {
       url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz";
-      sha256 = "00qa6l4jvkdny276jnwnra5dkagnp3qr43amf2mpqx3kdfw28g1q";
+      sha256 = "0yawgw6s8zd6a2n165aqg861giamgpsissj9mw6ax3a7wvg19zjr";
     };
   }; in [ rt-patch ] ++ kernelPatches;
 
diff --git a/pkgs/os-specific/linux/kernel/linux-rt-6.6.nix b/pkgs/os-specific/linux/kernel/linux-rt-6.6.nix
index 2f035b259b602..b0cda7d0710be 100644
--- a/pkgs/os-specific/linux/kernel/linux-rt-6.6.nix
+++ b/pkgs/os-specific/linux/kernel/linux-rt-6.6.nix
@@ -6,11 +6,12 @@
 , ... } @ args:
 
 let
-  version = "6.6.32-rt32"; # updated by ./update-rt.sh
+  version = "6.6.34-rt33"; # updated by ./update-rt.sh
   branch = lib.versions.majorMinor version;
   kversion = builtins.elemAt (lib.splitString "-" version) 0;
 in buildLinux (args // {
   inherit version;
+  pname = "linux-rt";
 
   # modDirVersion needs a patch number, change X.Y-rtZ to X.Y.0-rtZ.
   modDirVersion = if (builtins.match "[^.]*[.][^.]*-.*" version) == null then version
@@ -18,14 +19,14 @@ in buildLinux (args // {
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v6.x/linux-${kversion}.tar.xz";
-    sha256 = "1qbc8dqmk2xs1cz968rysw5xvhq3lj8g0pxp48fr2qbzy3m29a5a";
+    sha256 = "180v8q5376gl6zmjd54qcb1wpmz7cq299bdbhmz738rsb67yrq64";
   };
 
   kernelPatches = let rt-patch = {
     name = "rt";
     patch = fetchurl {
       url = "mirror://kernel/linux/kernel/projects/rt/${branch}/older/patch-${version}.patch.xz";
-      sha256 = "0hv2z6d2gw7hqfzw6dgrzxlirk4yifcxbmx71hxlvd9l2vgp72q5";
+      sha256 = "1sbbdv3mcca04g27vc7n4xv4kfhn9nz8xrhzzwc2r3f2x83ficwp";
     };
   }; in [ rt-patch ] ++ kernelPatches;
 
diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix
index 0c176d3e12d93..323b77e851404 100644
--- a/pkgs/os-specific/linux/kernel/manual-config.nix
+++ b/pkgs/os-specific/linux/kernel/manual-config.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, buildPackages, runCommand, nettools, bc, bison, flex, perl, rsync, gmp, libmpc, mpfr, openssl
-, libelf, cpio, elfutils, zstd, python3Minimal, zlib, pahole, kmod, ubootTools
+, cpio, elfutils, zstd, python3Minimal, zlib, pahole, kmod, ubootTools
 , fetchpatch
 , rustc, rust-bindgen, rustPlatform
 }:
@@ -20,6 +20,8 @@ let
 in lib.makeOverridable ({
   # The kernel version
   version,
+  # The kernel pname (should be set for variants)
+  pname ? "linux",
   # Position of the Linux build expression
   pos ? null,
   # Additional kernel make flags
@@ -118,7 +120,7 @@ let
       moduleBuildDependencies = [
         pahole
         perl
-        libelf
+        elfutils
         # module makefiles often run uname commands to find out the kernel version
         (buildPackages.deterministic-uname.override { inherit modDirVersion; })
       ]
@@ -140,13 +142,24 @@ let
       inherit src;
 
       depsBuildBuild = [ buildPackages.stdenv.cc ];
-      nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr zstd python3Minimal kmod ]
-                          ++ optional  needsUbootTools ubootTools
-                          ++ optional  (lib.versionOlder version "5.8") libelf
-                          ++ optionals (lib.versionAtLeast version "4.16") [ bison flex ]
-                          ++ optionals (lib.versionAtLeast version "5.2")  [ cpio pahole zlib ]
-                          ++ optional  (lib.versionAtLeast version "5.8")  elfutils
-                          ++ optionals withRust [ rustc rust-bindgen ];
+      nativeBuildInputs = [
+        bison
+        flex
+        perl
+        bc
+        nettools
+        openssl
+        rsync
+        gmp
+        libmpc
+        mpfr
+        elfutils
+        zstd
+        python3Minimal
+        kmod
+      ] ++ optional  needsUbootTools ubootTools
+        ++ optionals (lib.versionAtLeast version "5.2")  [ cpio pahole zlib ]
+        ++ optionals withRust [ rustc rust-bindgen ];
 
       RUST_LIB_SRC = lib.optionalString withRust rustPlatform.rustLibSrc;
 
@@ -170,12 +183,6 @@ let
         # Ensure that depmod gets resolved through PATH
         sed -i Makefile -e 's|= /sbin/depmod|= depmod|'
 
-        # Don't include a (random) NT_GNU_BUILD_ID, to make the build more deterministic.
-        # This way kernels can be bit-by-bit reproducible depending on settings
-        # (e.g. MODULE_SIG and SECURITY_LOCKDOWN_LSM need to be disabled).
-        # See also https://kernelnewbies.org/BuildId
-        sed -i Makefile -e 's|--build-id=[^ ]*|--build-id=none|'
-
         # Some linux-hardened patches now remove certain files in the scripts directory, so the file may not exist.
         [[ -f scripts/ld-version.sh ]] && patchShebangs scripts/ld-version.sh
 
@@ -404,12 +411,8 @@ let
     };
 in
 
-assert lib.versionOlder version "5.8" -> libelf != null;
-assert lib.versionAtLeast version "5.8" -> elfutils != null;
-
 stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPatches configfile) // {
-  pname = "linux";
-  inherit version;
+  inherit pname version;
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index 20100774395e1..c1715a91e5fbc 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -82,15 +82,21 @@
 
   rust_1_77-6_8 = {
     name = "rust-1.77.patch";
-    patch = fetchurl {
-      name = "rust-1.77.patch";
-      url = "https://lore.kernel.org/rust-for-linux/20240217002717.57507-1-ojeda@kernel.org/raw";
-      hash = "sha256-0KW9nHpJeMSDssCPXWZbrN8kxq5bA434t+XuPfwslUc=";
-    };
+    patch = ./rust-1.77-6.8.patch;
   };
 
   rust_1_77-6_9 = {
     name = "rust-1.77.patch";
     patch = ./rust-1.77.patch;
   };
+
+  rust_1_78 = {
+    name = "rust-1.78.patch";
+    patch = fetchpatch {
+      name = "rust-1.78.patch";
+      url = "https://lore.kernel.org/rust-for-linux/20240401212303.537355-4-ojeda@kernel.org/raw";
+      excludes = [ "Documentation/process/changes.rst" ]; # Conflicts on 6.8.
+      hash = "sha256-EZ+Qa9z1AtAv08e72M7BEsCZi9UK572gmW+AR62a8EM=";
+    };
+  };
 }
diff --git a/pkgs/os-specific/linux/kernel/rust-1.77-6.8.patch b/pkgs/os-specific/linux/kernel/rust-1.77-6.8.patch
new file mode 100644
index 0000000000000..4b25d3e60e39d
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/rust-1.77-6.8.patch
@@ -0,0 +1,799 @@
+From 82a754271336c7736fb0350692be85fecb30e38e Mon Sep 17 00:00:00 2001
+From: Miguel Ojeda <ojeda@kernel.org>
+Date: Sat, 17 Feb 2024 01:27:17 +0100
+Subject: [PATCH] rust: upgrade to Rust 1.77.1
+
+This is the next upgrade to the Rust toolchain, from 1.76.0 to 1.77.1
+(i.e. the latest) [1].
+
+See the upgrade policy [2] and the comments on the first upgrade in
+commit 3ed03f4da06e ("rust: upgrade to Rust 1.68.2").
+
+# Unstable features
+
+The `offset_of` feature (single-field `offset_of!`) that we were using
+got stabilized in Rust 1.77.0 [3].
+
+Therefore, now the only unstable features allowed to be used outside the
+`kernel` crate is `new_uninit`, though other code to be upstreamed may
+increase the list.
+
+Please see [4] for details.
+
+# Required changes
+
+Rust 1.77.0 merged the `unused_tuple_struct_fields` lint into `dead_code`,
+thus upgrading it from `allow` to `warn` [5]. In turn, this made `rustc`
+complain about the `ThisModule`'s pointer field being never read, but
+the previous patch adds the `as_ptr` method to it, needed by Binder [6],
+so that we do not need to locally `allow` it.
+
+# Other changes
+
+Rust 1.77.0 introduces the `--check-cfg` feature [7], for which there
+is a Call for Testing going on [8]. We were requested to test it and
+we found it useful [9] -- we will likely enable it in the future.
+
+# `alloc` upgrade and reviewing
+
+The vast majority of changes are due to our `alloc` fork being upgraded
+at once.
+
+There are two kinds of changes to be aware of: the ones coming from
+upstream, which we should follow as closely as possible, and the updates
+needed in our added fallible APIs to keep them matching the newer
+infallible APIs coming from upstream.
+
+Instead of taking a look at the diff of this patch, an alternative
+approach is reviewing a diff of the changes between upstream `alloc` and
+the kernel's. This allows to easily inspect the kernel additions only,
+especially to check if the fallible methods we already have still match
+the infallible ones in the new version coming from upstream.
+
+Another approach is reviewing the changes introduced in the additions in
+the kernel fork between the two versions. This is useful to spot
+potentially unintended changes to our additions.
+
+To apply these approaches, one may follow steps similar to the following
+to generate a pair of patches that show the differences between upstream
+Rust and the kernel (for the subset of `alloc` we use) before and after
+applying this patch:
+
+    # Get the difference with respect to the old version.
+    git -C rust checkout $(linux/scripts/min-tool-version.sh rustc)
+    git -C linux ls-tree -r --name-only HEAD -- rust/alloc |
+        cut -d/ -f3- |
+        grep -Fv README.md |
+        xargs -IPATH cp rust/library/alloc/src/PATH linux/rust/alloc/PATH
+    git -C linux diff --patch-with-stat --summary -R > old.patch
+    git -C linux restore rust/alloc
+
+    # Apply this patch.
+    git -C linux am rust-upgrade.patch
+
+    # Get the difference with respect to the new version.
+    git -C rust checkout $(linux/scripts/min-tool-version.sh rustc)
+    git -C linux ls-tree -r --name-only HEAD -- rust/alloc |
+        cut -d/ -f3- |
+        grep -Fv README.md |
+        xargs -IPATH cp rust/library/alloc/src/PATH linux/rust/alloc/PATH
+    git -C linux diff --patch-with-stat --summary -R > new.patch
+    git -C linux restore rust/alloc
+
+Now one may check the `new.patch` to take a look at the additions (first
+approach) or at the difference between those two patches (second
+approach). For the latter, a side-by-side tool is recommended.
+
+Link: https://github.com/rust-lang/rust/blob/stable/RELEASES.md#version-1770-2024-03-21 [1]
+Link: https://rust-for-linux.com/rust-version-policy [2]
+Link: https://github.com/rust-lang/rust/pull/118799 [3]
+Link: https://github.com/Rust-for-Linux/linux/issues/2 [4]
+Link: https://github.com/rust-lang/rust/pull/118297 [5]
+Link: https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-2-08ba9197f637@google.com/#Z31rust:kernel:lib.rs [6]
+Link: https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html [7]
+Link: https://github.com/rust-lang/rfcs/pull/3013#issuecomment-1936648479 [8]
+Link: https://github.com/rust-lang/rust/issues/82450#issuecomment-1947462977 [9]
+Reviewed-by: Alice Ryhl <aliceryhl@google.com>
+Tested-by: Boqun Feng <boqun.feng@gmail.com>
+Link: https://lore.kernel.org/r/20240217002717.57507-1-ojeda@kernel.org
+[ Upgraded to 1.77.1. Removed `allow(dead_code)` thanks to the previous
+  patch. Reworded accordingly. No changes to `alloc` during the beta. ]
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Alyssa Ross <hi@alyssa.is>
+
+# Conflicts:
+#	Documentation/process/changes.rst
+#	rust/kernel/lib.rs
+---
+ Documentation/process/changes.rst |   2 +-
+ rust/alloc/alloc.rs               |   6 +-
+ rust/alloc/boxed.rs               |   4 +-
+ rust/alloc/lib.rs                 |   7 +-
+ rust/alloc/raw_vec.rs             |  13 ++--
+ rust/alloc/slice.rs               |   4 +-
+ rust/alloc/vec/into_iter.rs       | 104 +++++++++++++++++++-----------
+ rust/alloc/vec/mod.rs             | 101 ++++++++++++++++++++---------
+ rust/kernel/lib.rs                |   1 -
+ scripts/Makefile.build            |   2 +-
+ scripts/min-tool-version.sh       |   2 +-
+ 11 files changed, 158 insertions(+), 88 deletions(-)
+
+diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
+index c78ecc1e176f..641d67363b92 100644
+--- a/Documentation/process/changes.rst
++++ b/Documentation/process/changes.rst
+@@ -31,7 +31,7 @@ you probably needn't concern yourself with pcmciautils.
+ ====================== ===============  ========================================
+ GNU C                  5.1              gcc --version
+ Clang/LLVM (optional)  11.0.0           clang --version
+-Rust (optional)        1.76.0           rustc --version
++Rust (optional)        1.77.1           rustc --version
+ bindgen (optional)     0.65.1           bindgen --version
+ GNU make               3.82             make --version
+ bash                   4.2              bash --version
+diff --git a/rust/alloc/alloc.rs b/rust/alloc/alloc.rs
+index abb791cc2371..b1204f87227b 100644
+--- a/rust/alloc/alloc.rs
++++ b/rust/alloc/alloc.rs
+@@ -5,7 +5,7 @@
+ #![stable(feature = "alloc_module", since = "1.28.0")]
+ 
+ #[cfg(not(test))]
+-use core::intrinsics;
++use core::hint;
+ 
+ #[cfg(not(test))]
+ use core::ptr::{self, NonNull};
+@@ -210,7 +210,7 @@ unsafe fn grow_impl(
+                 let new_size = new_layout.size();
+ 
+                 // `realloc` probably checks for `new_size >= old_layout.size()` or something similar.
+-                intrinsics::assume(new_size >= old_layout.size());
++                hint::assert_unchecked(new_size >= old_layout.size());
+ 
+                 let raw_ptr = realloc(ptr.as_ptr(), old_layout, new_size);
+                 let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;
+@@ -301,7 +301,7 @@ unsafe fn shrink(
+             // SAFETY: `new_size` is non-zero. Other conditions must be upheld by the caller
+             new_size if old_layout.align() == new_layout.align() => unsafe {
+                 // `realloc` probably checks for `new_size <= old_layout.size()` or something similar.
+-                intrinsics::assume(new_size <= old_layout.size());
++                hint::assert_unchecked(new_size <= old_layout.size());
+ 
+                 let raw_ptr = realloc(ptr.as_ptr(), old_layout, new_size);
+                 let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;
+diff --git a/rust/alloc/boxed.rs b/rust/alloc/boxed.rs
+index c93a22a5c97f..5fc39dfeb8e7 100644
+--- a/rust/alloc/boxed.rs
++++ b/rust/alloc/boxed.rs
+@@ -26,6 +26,7 @@
+ //! Creating a recursive data structure:
+ //!
+ //! ```
++//! ##[allow(dead_code)]
+ //! #[derive(Debug)]
+ //! enum List<T> {
+ //!     Cons(T, Box<List<T>>),
+@@ -194,8 +195,7 @@
+ #[fundamental]
+ #[stable(feature = "rust1", since = "1.0.0")]
+ // The declaration of the `Box` struct must be kept in sync with the
+-// `alloc::alloc::box_free` function or ICEs will happen. See the comment
+-// on `box_free` for more details.
++// compiler or ICEs will happen.
+ pub struct Box<
+     T: ?Sized,
+     #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
+diff --git a/rust/alloc/lib.rs b/rust/alloc/lib.rs
+index 36f79c075593..39afd55ec074 100644
+--- a/rust/alloc/lib.rs
++++ b/rust/alloc/lib.rs
+@@ -105,7 +105,6 @@
+ #![feature(allocator_api)]
+ #![feature(array_chunks)]
+ #![feature(array_into_iter_constructors)]
+-#![feature(array_methods)]
+ #![feature(array_windows)]
+ #![feature(ascii_char)]
+ #![feature(assert_matches)]
+@@ -122,7 +121,6 @@
+ #![feature(const_size_of_val)]
+ #![feature(const_waker)]
+ #![feature(core_intrinsics)]
+-#![feature(core_panic)]
+ #![feature(deprecated_suggestion)]
+ #![feature(dispatch_from_dyn)]
+ #![feature(error_generic_member_access)]
+@@ -132,6 +130,7 @@
+ #![feature(fmt_internals)]
+ #![feature(fn_traits)]
+ #![feature(hasher_prefixfree_extras)]
++#![feature(hint_assert_unchecked)]
+ #![feature(inline_const)]
+ #![feature(inplace_iteration)]
+ #![feature(iter_advance_by)]
+@@ -141,6 +140,8 @@
+ #![feature(maybe_uninit_slice)]
+ #![feature(maybe_uninit_uninit_array)]
+ #![feature(maybe_uninit_uninit_array_transpose)]
++#![feature(non_null_convenience)]
++#![feature(panic_internals)]
+ #![feature(pattern)]
+ #![feature(ptr_internals)]
+ #![feature(ptr_metadata)]
+@@ -149,7 +150,6 @@
+ #![feature(set_ptr_value)]
+ #![feature(sized_type_properties)]
+ #![feature(slice_from_ptr_range)]
+-#![feature(slice_group_by)]
+ #![feature(slice_ptr_get)]
+ #![feature(slice_ptr_len)]
+ #![feature(slice_range)]
+@@ -182,6 +182,7 @@
+ #![feature(const_ptr_write)]
+ #![feature(const_trait_impl)]
+ #![feature(const_try)]
++#![feature(decl_macro)]
+ #![feature(dropck_eyepatch)]
+ #![feature(exclusive_range_pattern)]
+ #![feature(fundamental)]
+diff --git a/rust/alloc/raw_vec.rs b/rust/alloc/raw_vec.rs
+index 98b6abf30af6..1839d1c8ee7a 100644
+--- a/rust/alloc/raw_vec.rs
++++ b/rust/alloc/raw_vec.rs
+@@ -4,7 +4,7 @@
+ 
+ use core::alloc::LayoutError;
+ use core::cmp;
+-use core::intrinsics;
++use core::hint;
+ use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
+ use core::ptr::{self, NonNull, Unique};
+ use core::slice;
+@@ -317,7 +317,7 @@ fn current_memory(&self) -> Option<(NonNull<u8>, Layout)> {
+     ///
+     /// # Panics
+     ///
+-    /// Panics if the new capacity exceeds `isize::MAX` bytes.
++    /// Panics if the new capacity exceeds `isize::MAX` _bytes_.
+     ///
+     /// # Aborts
+     ///
+@@ -358,7 +358,7 @@ pub fn try_reserve(&mut self, len: usize, additional: usize) -> Result<(), TryRe
+         }
+         unsafe {
+             // Inform the optimizer that the reservation has succeeded or wasn't needed
+-            core::intrinsics::assume(!self.needs_to_grow(len, additional));
++            hint::assert_unchecked(!self.needs_to_grow(len, additional));
+         }
+         Ok(())
+     }
+@@ -381,7 +381,7 @@ pub fn try_reserve_for_push(&mut self, len: usize) -> Result<(), TryReserveError
+     ///
+     /// # Panics
+     ///
+-    /// Panics if the new capacity exceeds `isize::MAX` bytes.
++    /// Panics if the new capacity exceeds `isize::MAX` _bytes_.
+     ///
+     /// # Aborts
+     ///
+@@ -402,7 +402,7 @@ pub fn try_reserve_exact(
+         }
+         unsafe {
+             // Inform the optimizer that the reservation has succeeded or wasn't needed
+-            core::intrinsics::assume(!self.needs_to_grow(len, additional));
++            hint::assert_unchecked(!self.needs_to_grow(len, additional));
+         }
+         Ok(())
+     }
+@@ -553,7 +553,7 @@ fn finish_grow<A>(
+         debug_assert_eq!(old_layout.align(), new_layout.align());
+         unsafe {
+             // The allocator checks for alignment equality
+-            intrinsics::assume(old_layout.align() == new_layout.align());
++            hint::assert_unchecked(old_layout.align() == new_layout.align());
+             alloc.grow(ptr, old_layout, new_layout)
+         }
+     } else {
+@@ -591,7 +591,6 @@ fn handle_reserve(result: Result<(), TryReserveError>) {
+ // `> isize::MAX` bytes will surely fail. On 32-bit and 16-bit we need to add
+ // an extra guard for this in case we're running on a platform which can use
+ // all 4GB in user-space, e.g., PAE or x32.
+-
+ #[inline]
+ fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
+     if usize::BITS < 64 && alloc_size > isize::MAX as usize {
+diff --git a/rust/alloc/slice.rs b/rust/alloc/slice.rs
+index 1181836da5f4..a36b072c9519 100644
+--- a/rust/alloc/slice.rs
++++ b/rust/alloc/slice.rs
+@@ -53,14 +53,14 @@
+ pub use core::slice::{from_mut_ptr_range, from_ptr_range};
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub use core::slice::{from_raw_parts, from_raw_parts_mut};
++#[stable(feature = "slice_group_by", since = "1.77.0")]
++pub use core::slice::{ChunkBy, ChunkByMut};
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub use core::slice::{Chunks, Windows};
+ #[stable(feature = "chunks_exact", since = "1.31.0")]
+ pub use core::slice::{ChunksExact, ChunksExactMut};
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub use core::slice::{ChunksMut, Split, SplitMut};
+-#[unstable(feature = "slice_group_by", issue = "80552")]
+-pub use core::slice::{GroupBy, GroupByMut};
+ #[stable(feature = "rust1", since = "1.0.0")]
+ pub use core::slice::{Iter, IterMut};
+ #[stable(feature = "rchunks", since = "1.31.0")]
+diff --git a/rust/alloc/vec/into_iter.rs b/rust/alloc/vec/into_iter.rs
+index 136bfe94af6c..0f11744c44b3 100644
+--- a/rust/alloc/vec/into_iter.rs
++++ b/rust/alloc/vec/into_iter.rs
+@@ -20,6 +20,17 @@
+ use core::ptr::{self, NonNull};
+ use core::slice::{self};
+ 
++macro non_null {
++    (mut $place:expr, $t:ident) => {{
++        #![allow(unused_unsafe)] // we're sometimes used within an unsafe block
++        unsafe { &mut *(ptr::addr_of_mut!($place) as *mut NonNull<$t>) }
++    }},
++    ($place:expr, $t:ident) => {{
++        #![allow(unused_unsafe)] // we're sometimes used within an unsafe block
++        unsafe { *(ptr::addr_of!($place) as *const NonNull<$t>) }
++    }},
++}
++
+ /// An iterator that moves out of a vector.
+ ///
+ /// This `struct` is created by the `into_iter` method on [`Vec`](super::Vec)
+@@ -43,10 +54,12 @@ pub struct IntoIter<
+     // the drop impl reconstructs a RawVec from buf, cap and alloc
+     // to avoid dropping the allocator twice we need to wrap it into ManuallyDrop
+     pub(super) alloc: ManuallyDrop<A>,
+-    pub(super) ptr: *const T,
+-    pub(super) end: *const T, // If T is a ZST, this is actually ptr+len. This encoding is picked so that
+-                              // ptr == end is a quick test for the Iterator being empty, that works
+-                              // for both ZST and non-ZST.
++    pub(super) ptr: NonNull<T>,
++    /// If T is a ZST, this is actually ptr+len. This encoding is picked so that
++    /// ptr == end is a quick test for the Iterator being empty, that works
++    /// for both ZST and non-ZST.
++    /// For non-ZSTs the pointer is treated as `NonNull<T>`
++    pub(super) end: *const T,
+ }
+ 
+ #[stable(feature = "vec_intoiter_debug", since = "1.13.0")]
+@@ -70,7 +83,7 @@ impl<T, A: Allocator> IntoIter<T, A> {
+     /// ```
+     #[stable(feature = "vec_into_iter_as_slice", since = "1.15.0")]
+     pub fn as_slice(&self) -> &[T] {
+-        unsafe { slice::from_raw_parts(self.ptr, self.len()) }
++        unsafe { slice::from_raw_parts(self.ptr.as_ptr(), self.len()) }
+     }
+ 
+     /// Returns the remaining items of this iterator as a mutable slice.
+@@ -99,7 +112,7 @@ pub fn allocator(&self) -> &A {
+     }
+ 
+     fn as_raw_mut_slice(&mut self) -> *mut [T] {
+-        ptr::slice_from_raw_parts_mut(self.ptr as *mut T, self.len())
++        ptr::slice_from_raw_parts_mut(self.ptr.as_ptr(), self.len())
+     }
+ 
+     /// Drops remaining elements and relinquishes the backing allocation.
+@@ -126,7 +139,7 @@ pub(super) fn forget_allocation_drop_remaining(&mut self) {
+         // this creates less assembly
+         self.cap = 0;
+         self.buf = unsafe { NonNull::new_unchecked(RawVec::NEW.ptr()) };
+-        self.ptr = self.buf.as_ptr();
++        self.ptr = self.buf;
+         self.end = self.buf.as_ptr();
+ 
+         // Dropping the remaining elements can panic, so this needs to be
+@@ -138,9 +151,9 @@ pub(super) fn forget_allocation_drop_remaining(&mut self) {
+ 
+     /// Forgets to Drop the remaining elements while still allowing the backing allocation to be freed.
+     pub(crate) fn forget_remaining_elements(&mut self) {
+-        // For th ZST case, it is crucial that we mutate `end` here, not `ptr`.
++        // For the ZST case, it is crucial that we mutate `end` here, not `ptr`.
+         // `ptr` must stay aligned, while `end` may be unaligned.
+-        self.end = self.ptr;
++        self.end = self.ptr.as_ptr();
+     }
+ 
+     #[cfg(not(no_global_oom_handling))]
+@@ -162,7 +175,7 @@ pub(crate) fn into_vecdeque(self) -> VecDeque<T, A> {
+                 // say that they're all at the beginning of the "allocation".
+                 0..this.len()
+             } else {
+-                this.ptr.sub_ptr(buf)..this.end.sub_ptr(buf)
++                this.ptr.sub_ptr(this.buf)..this.end.sub_ptr(buf)
+             };
+             let cap = this.cap;
+             let alloc = ManuallyDrop::take(&mut this.alloc);
+@@ -189,29 +202,35 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
+ 
+     #[inline]
+     fn next(&mut self) -> Option<T> {
+-        if self.ptr == self.end {
+-            None
+-        } else if T::IS_ZST {
+-            // `ptr` has to stay where it is to remain aligned, so we reduce the length by 1 by
+-            // reducing the `end`.
+-            self.end = self.end.wrapping_byte_sub(1);
++        if T::IS_ZST {
++            if self.ptr.as_ptr() == self.end as *mut _ {
++                None
++            } else {
++                // `ptr` has to stay where it is to remain aligned, so we reduce the length by 1 by
++                // reducing the `end`.
++                self.end = self.end.wrapping_byte_sub(1);
+ 
+-            // Make up a value of this ZST.
+-            Some(unsafe { mem::zeroed() })
++                // Make up a value of this ZST.
++                Some(unsafe { mem::zeroed() })
++            }
+         } else {
+-            let old = self.ptr;
+-            self.ptr = unsafe { self.ptr.add(1) };
++            if self.ptr == non_null!(self.end, T) {
++                None
++            } else {
++                let old = self.ptr;
++                self.ptr = unsafe { old.add(1) };
+ 
+-            Some(unsafe { ptr::read(old) })
++                Some(unsafe { ptr::read(old.as_ptr()) })
++            }
+         }
+     }
+ 
+     #[inline]
+     fn size_hint(&self) -> (usize, Option<usize>) {
+         let exact = if T::IS_ZST {
+-            self.end.addr().wrapping_sub(self.ptr.addr())
++            self.end.addr().wrapping_sub(self.ptr.as_ptr().addr())
+         } else {
+-            unsafe { self.end.sub_ptr(self.ptr) }
++            unsafe { non_null!(self.end, T).sub_ptr(self.ptr) }
+         };
+         (exact, Some(exact))
+     }
+@@ -219,7 +238,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
+     #[inline]
+     fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
+         let step_size = self.len().min(n);
+-        let to_drop = ptr::slice_from_raw_parts_mut(self.ptr as *mut T, step_size);
++        let to_drop = ptr::slice_from_raw_parts_mut(self.ptr.as_ptr(), step_size);
+         if T::IS_ZST {
+             // See `next` for why we sub `end` here.
+             self.end = self.end.wrapping_byte_sub(step_size);
+@@ -261,7 +280,7 @@ fn count(self) -> usize {
+             // Safety: `len` indicates that this many elements are available and we just checked that
+             // it fits into the array.
+             unsafe {
+-                ptr::copy_nonoverlapping(self.ptr, raw_ary.as_mut_ptr() as *mut T, len);
++                ptr::copy_nonoverlapping(self.ptr.as_ptr(), raw_ary.as_mut_ptr() as *mut T, len);
+                 self.forget_remaining_elements();
+                 return Err(array::IntoIter::new_unchecked(raw_ary, 0..len));
+             }
+@@ -270,7 +289,7 @@ fn count(self) -> usize {
+         // Safety: `len` is larger than the array size. Copy a fixed amount here to fully initialize
+         // the array.
+         return unsafe {
+-            ptr::copy_nonoverlapping(self.ptr, raw_ary.as_mut_ptr() as *mut T, N);
++            ptr::copy_nonoverlapping(self.ptr.as_ptr(), raw_ary.as_mut_ptr() as *mut T, N);
+             self.ptr = self.ptr.add(N);
+             Ok(raw_ary.transpose().assume_init())
+         };
+@@ -288,7 +307,7 @@ unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item
+         // Also note the implementation of `Self: TrustedRandomAccess` requires
+         // that `T: Copy` so reading elements from the buffer doesn't invalidate
+         // them for `Drop`.
+-        unsafe { if T::IS_ZST { mem::zeroed() } else { ptr::read(self.ptr.add(i)) } }
++        unsafe { if T::IS_ZST { mem::zeroed() } else { self.ptr.add(i).read() } }
+     }
+ }
+ 
+@@ -296,18 +315,25 @@ unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item
+ impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A> {
+     #[inline]
+     fn next_back(&mut self) -> Option<T> {
+-        if self.end == self.ptr {
+-            None
+-        } else if T::IS_ZST {
+-            // See above for why 'ptr.offset' isn't used
+-            self.end = self.end.wrapping_byte_sub(1);
++        if T::IS_ZST {
++            if self.end as *mut _ == self.ptr.as_ptr() {
++                None
++            } else {
++                // See above for why 'ptr.offset' isn't used
++                self.end = self.end.wrapping_byte_sub(1);
+ 
+-            // Make up a value of this ZST.
+-            Some(unsafe { mem::zeroed() })
++                // Make up a value of this ZST.
++                Some(unsafe { mem::zeroed() })
++            }
+         } else {
+-            self.end = unsafe { self.end.sub(1) };
++            if non_null!(self.end, T) == self.ptr {
++                None
++            } else {
++                let new_end = unsafe { non_null!(self.end, T).sub(1) };
++                *non_null!(mut self.end, T) = new_end;
+ 
+-            Some(unsafe { ptr::read(self.end) })
++                Some(unsafe { ptr::read(new_end.as_ptr()) })
++            }
+         }
+     }
+ 
+@@ -333,7 +359,11 @@ fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
+ #[stable(feature = "rust1", since = "1.0.0")]
+ impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A> {
+     fn is_empty(&self) -> bool {
+-        self.ptr == self.end
++        if T::IS_ZST {
++            self.ptr.as_ptr() == self.end as *mut _
++        } else {
++            self.ptr == non_null!(self.end, T)
++        }
+     }
+ }
+ 
+diff --git a/rust/alloc/vec/mod.rs b/rust/alloc/vec/mod.rs
+index 220fb9d6f45b..0be27fff4554 100644
+--- a/rust/alloc/vec/mod.rs
++++ b/rust/alloc/vec/mod.rs
+@@ -360,7 +360,7 @@
+ ///
+ /// `vec![x; n]`, `vec![a, b, c, d]`, and
+ /// [`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`
+-/// with exactly the requested capacity. If <code>[len] == [capacity]</code>,
++/// with at least the requested capacity. If <code>[len] == [capacity]</code>,
+ /// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to
+ /// and from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.
+ ///
+@@ -447,7 +447,7 @@ pub const fn new() -> Self {
+     ///
+     /// # Panics
+     ///
+-    /// Panics if the new capacity exceeds `isize::MAX` bytes.
++    /// Panics if the new capacity exceeds `isize::MAX` _bytes_.
+     ///
+     /// # Examples
+     ///
+@@ -690,7 +690,7 @@ pub const fn new_in(alloc: A) -> Self {
+     ///
+     /// # Panics
+     ///
+-    /// Panics if the new capacity exceeds `isize::MAX` bytes.
++    /// Panics if the new capacity exceeds `isize::MAX` _bytes_.
+     ///
+     /// # Examples
+     ///
+@@ -1013,7 +1013,7 @@ pub fn capacity(&self) -> usize {
+     ///
+     /// # Panics
+     ///
+-    /// Panics if the new capacity exceeds `isize::MAX` bytes.
++    /// Panics if the new capacity exceeds `isize::MAX` _bytes_.
+     ///
+     /// # Examples
+     ///
+@@ -1043,7 +1043,7 @@ pub fn reserve(&mut self, additional: usize) {
+     ///
+     /// # Panics
+     ///
+-    /// Panics if the new capacity exceeds `isize::MAX` bytes.
++    /// Panics if the new capacity exceeds `isize::MAX` _bytes_.
+     ///
+     /// # Examples
+     ///
+@@ -1140,8 +1140,11 @@ pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveE
+ 
+     /// Shrinks the capacity of the vector as much as possible.
+     ///
+-    /// It will drop down as close as possible to the length but the allocator
+-    /// may still inform the vector that there is space for a few more elements.
++    /// The behavior of this method depends on the allocator, which may either shrink the vector
++    /// in-place or reallocate. The resulting vector might still have some excess capacity, just as
++    /// is the case for [`with_capacity`]. See [`Allocator::shrink`] for more details.
++    ///
++    /// [`with_capacity`]: Vec::with_capacity
+     ///
+     /// # Examples
+     ///
+@@ -1191,10 +1194,10 @@ pub fn shrink_to(&mut self, min_capacity: usize) {
+ 
+     /// Converts the vector into [`Box<[T]>`][owned slice].
+     ///
+-    /// If the vector has excess capacity, its items will be moved into a
+-    /// newly-allocated buffer with exactly the right capacity.
++    /// Before doing the conversion, this method discards excess capacity like [`shrink_to_fit`].
+     ///
+     /// [owned slice]: Box
++    /// [`shrink_to_fit`]: Vec::shrink_to_fit
+     ///
+     /// # Examples
+     ///
+@@ -2017,7 +2020,7 @@ fn drop(&mut self) {
+     ///
+     /// # Panics
+     ///
+-    /// Panics if the new capacity exceeds `isize::MAX` bytes.
++    /// Panics if the new capacity exceeds `isize::MAX` _bytes_.
+     ///
+     /// # Examples
+     ///
+@@ -2133,7 +2136,7 @@ pub fn pop(&mut self) -> Option<T> {
+         } else {
+             unsafe {
+                 self.len -= 1;
+-                core::intrinsics::assume(self.len < self.capacity());
++                core::hint::assert_unchecked(self.len < self.capacity());
+                 Some(ptr::read(self.as_ptr().add(self.len())))
+             }
+         }
+@@ -2143,7 +2146,7 @@ pub fn pop(&mut self) -> Option<T> {
+     ///
+     /// # Panics
+     ///
+-    /// Panics if the new capacity exceeds `isize::MAX` bytes.
++    /// Panics if the new capacity exceeds `isize::MAX` _bytes_.
+     ///
+     /// # Examples
+     ///
+@@ -2315,6 +2318,12 @@ pub fn is_empty(&self) -> bool {
+     /// `[at, len)`. After the call, the original vector will be left containing
+     /// the elements `[0, at)` with its previous capacity unchanged.
+     ///
++    /// - If you want to take ownership of the entire contents and capacity of
++    ///   the vector, see [`mem::take`] or [`mem::replace`].
++    /// - If you don't need the returned vector at all, see [`Vec::truncate`].
++    /// - If you want to take ownership of an arbitrary subslice, or you don't
++    ///   necessarily want to store the removed items in a vector, see [`Vec::drain`].
++    ///
+     /// # Panics
+     ///
+     /// Panics if `at > len`.
+@@ -2346,14 +2355,6 @@ fn assert_failed(at: usize, len: usize) -> ! {
+             assert_failed(at, self.len());
+         }
+ 
+-        if at == 0 {
+-            // the new vector can take over the original buffer and avoid the copy
+-            return mem::replace(
+-                self,
+-                Vec::with_capacity_in(self.capacity(), self.allocator().clone()),
+-            );
+-        }
+-
+         let other_len = self.len - at;
+         let mut other = Vec::with_capacity_in(other_len, self.allocator().clone());
+ 
+@@ -3027,6 +3028,50 @@ fn index_mut(&mut self, index: I) -> &mut Self::Output {
+     }
+ }
+ 
++/// Collects an iterator into a Vec, commonly called via [`Iterator::collect()`]
++///
++/// # Allocation behavior
++///
++/// In general `Vec` does not guarantee any particular growth or allocation strategy.
++/// That also applies to this trait impl.
++///
++/// **Note:** This section covers implementation details and is therefore exempt from
++/// stability guarantees.
++///
++/// Vec may use any or none of the following strategies,
++/// depending on the supplied iterator:
++///
++/// * preallocate based on [`Iterator::size_hint()`]
++///   * and panic if the number of items is outside the provided lower/upper bounds
++/// * use an amortized growth strategy similar to `pushing` one item at a time
++/// * perform the iteration in-place on the original allocation backing the iterator
++///
++/// The last case warrants some attention. It is an optimization that in many cases reduces peak memory
++/// consumption and improves cache locality. But when big, short-lived allocations are created,
++/// only a small fraction of their items get collected, no further use is made of the spare capacity
++/// and the resulting `Vec` is moved into a longer-lived structure, then this can lead to the large
++/// allocations having their lifetimes unnecessarily extended which can result in increased memory
++/// footprint.
++///
++/// In cases where this is an issue, the excess capacity can be discarded with [`Vec::shrink_to()`],
++/// [`Vec::shrink_to_fit()`] or by collecting into [`Box<[T]>`][owned slice] instead, which additionally reduces
++/// the size of the long-lived struct.
++///
++/// [owned slice]: Box
++///
++/// ```rust
++/// # use std::sync::Mutex;
++/// static LONG_LIVED: Mutex<Vec<Vec<u16>>> = Mutex::new(Vec::new());
++///
++/// for i in 0..10 {
++///     let big_temporary: Vec<u16> = (0..1024).collect();
++///     // discard most items
++///     let mut result: Vec<_> = big_temporary.into_iter().filter(|i| i % 100 == 0).collect();
++///     // without this a lot of unused capacity might be moved into the global
++///     result.shrink_to_fit();
++///     LONG_LIVED.lock().unwrap().push(result);
++/// }
++/// ```
+ #[cfg(not(no_global_oom_handling))]
+ #[stable(feature = "rust1", since = "1.0.0")]
+ impl<T> FromIterator<T> for Vec<T> {
+@@ -3069,14 +3114,8 @@ fn into_iter(self) -> Self::IntoIter {
+                 begin.add(me.len()) as *const T
+             };
+             let cap = me.buf.capacity();
+-            IntoIter {
+-                buf: NonNull::new_unchecked(begin),
+-                phantom: PhantomData,
+-                cap,
+-                alloc,
+-                ptr: begin,
+-                end,
+-            }
++            let buf = NonNull::new_unchecked(begin);
++            IntoIter { buf, phantom: PhantomData, cap, alloc, ptr: buf, end }
+         }
+     }
+ }
+@@ -3598,8 +3637,10 @@ fn from(s: Box<[T], A>) -> Self {
+ impl<T, A: Allocator> From<Vec<T, A>> for Box<[T], A> {
+     /// Convert a vector into a boxed slice.
+     ///
+-    /// If `v` has excess capacity, its items will be moved into a
+-    /// newly-allocated buffer with exactly the right capacity.
++    /// Before doing the conversion, this method discards excess capacity like [`Vec::shrink_to_fit`].
++    ///
++    /// [owned slice]: Box
++    /// [`Vec::shrink_to_fit`]: Vec::shrink_to_fit
+     ///
+     /// # Examples
+     ///
+diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
+index 75efe47522e4..f07bc5a2c6b4 100644
+--- a/rust/kernel/lib.rs
++++ b/rust/kernel/lib.rs
+@@ -17,7 +17,6 @@
+ #![feature(const_maybe_uninit_zeroed)]
+ #![feature(dispatch_from_dyn)]
+ #![feature(new_uninit)]
+-#![feature(offset_of)]
+ #![feature(ptr_metadata)]
+ #![feature(receiver_trait)]
+ #![feature(unsize)]
+diff --git a/scripts/Makefile.build b/scripts/Makefile.build
+index 1633175846df..0bc7c5fe64b1 100644
+--- a/scripts/Makefile.build
++++ b/scripts/Makefile.build
+@@ -262,7 +262,7 @@ $(obj)/%.lst: $(src)/%.c FORCE
+ # Compile Rust sources (.rs)
+ # ---------------------------------------------------------------------------
+ 
+-rust_allowed_features := new_uninit,offset_of
++rust_allowed_features := new_uninit
+ 
+ # `--out-dir` is required to avoid temporaries being created by `rustc` in the
+ # current working directory, which may be not accessible in the out-of-tree
+diff --git a/scripts/min-tool-version.sh b/scripts/min-tool-version.sh
+index e217683b10d6..db2b0bc5866b 100755
+--- a/scripts/min-tool-version.sh
++++ b/scripts/min-tool-version.sh
+@@ -33,7 +33,7 @@ llvm)
+ 	fi
+ 	;;
+ rustc)
+-	echo 1.76.0
++	echo 1.77.1
+ 	;;
+ bindgen)
+ 	echo 0.65.1
+-- 
+2.44.0
+
diff --git a/pkgs/os-specific/linux/kernel/rust-1.77.patch b/pkgs/os-specific/linux/kernel/rust-1.77.patch
index 8bd0a5e337154..ed9eb56bf6d7e 100644
--- a/pkgs/os-specific/linux/kernel/rust-1.77.patch
+++ b/pkgs/os-specific/linux/kernel/rust-1.77.patch
@@ -1,14 +1,16 @@
-From d69265b7d756931b2e763a3262f22ba4100895a0 Mon Sep 17 00:00:00 2001
+From b256fc507d4710287b22077834c16d18cee4ab17 Mon Sep 17 00:00:00 2001
 From: Miguel Ojeda <ojeda@kernel.org>
 Date: Sat, 17 Feb 2024 01:27:17 +0100
-Subject: [PATCH] rust: upgrade to Rust 1.77.0
+Subject: [PATCH] rust: upgrade to Rust 1.77.1
 
-This is the next upgrade to the Rust toolchain, from 1.76.0 to 1.77.0
+This is the next upgrade to the Rust toolchain, from 1.76.0 to 1.77.1
 (i.e. the latest) [1].
 
 See the upgrade policy [2] and the comments on the first upgrade in
 commit 3ed03f4da06e ("rust: upgrade to Rust 1.68.2").
 
+# Unstable features
+
 The `offset_of` feature (single-field `offset_of!`) that we were using
 got stabilized in Rust 1.77.0 [3].
 
@@ -18,16 +20,22 @@ increase the list.
 
 Please see [4] for details.
 
+# Required changes
+
 Rust 1.77.0 merged the `unused_tuple_struct_fields` lint into `dead_code`,
-thus upgrading it from `allow` to `warn` [5]. In turn, this makes `rustc`
-complain about the `ThisModule`'s pointer field being never read. Thus
-locally `allow` it for the moment, since we will have users later on
-(e.g. Binder needs a `as_ptr` method [6]).
+thus upgrading it from `allow` to `warn` [5]. In turn, this made `rustc`
+complain about the `ThisModule`'s pointer field being never read, but
+the previous patch adds the `as_ptr` method to it, needed by Binder [6],
+so that we do not need to locally `allow` it.
+
+# Other changes
 
 Rust 1.77.0 introduces the `--check-cfg` feature [7], for which there
 is a Call for Testing going on [8]. We were requested to test it and
 we found it useful [9] -- we will likely enable it in the future.
 
+# `alloc` upgrade and reviewing
+
 The vast majority of changes are due to our `alloc` fork being upgraded
 at once.
 
@@ -85,9 +93,12 @@ Link: https://lore.kernel.org/rust-for-linux/20231101-rust-binder-v1-2-08ba9197f
 Link: https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html [7]
 Link: https://github.com/rust-lang/rfcs/pull/3013#issuecomment-1936648479 [8]
 Link: https://github.com/rust-lang/rust/issues/82450#issuecomment-1947462977 [9]
-Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Reviewed-by: Alice Ryhl <aliceryhl@google.com>
+Tested-by: Boqun Feng <boqun.feng@gmail.com>
 Link: https://lore.kernel.org/r/20240217002717.57507-1-ojeda@kernel.org
-Link: https://github.com/Rust-for-Linux/linux/commit/d69265b7d756931b2e763a3262f22ba4100895a0
+[ Upgraded to 1.77.1. Removed `allow(dead_code)` thanks to the previous
+  patch. Reworded accordingly. No changes to `alloc` during the beta. ]
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
 Signed-off-by: Alyssa Ross <hi@alyssa.is>
 ---
  Documentation/process/changes.rst |   2 +-
@@ -96,15 +107,15 @@ Signed-off-by: Alyssa Ross <hi@alyssa.is>
  rust/alloc/lib.rs                 |   7 +-
  rust/alloc/raw_vec.rs             |  13 ++--
  rust/alloc/slice.rs               |   4 +-
- rust/alloc/vec/into_iter.rs       | 108 +++++++++++++++++++-----------
- rust/alloc/vec/mod.rs             | 101 +++++++++++++++++++---------
- rust/kernel/lib.rs                |   3 +-
+ rust/alloc/vec/into_iter.rs       | 104 +++++++++++++++++++-----------
+ rust/alloc/vec/mod.rs             | 101 ++++++++++++++++++++---------
+ rust/kernel/lib.rs                |   1 -
  scripts/Makefile.build            |   2 +-
  scripts/min-tool-version.sh       |   2 +-
- 11 files changed, 161 insertions(+), 91 deletions(-)
+ 11 files changed, 158 insertions(+), 88 deletions(-)
 
 diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
-index 7ef8de58f7f892..879ee628893ae1 100644
+index 7ef8de58f7f8..b5d3107c6734 100644
 --- a/Documentation/process/changes.rst
 +++ b/Documentation/process/changes.rst
 @@ -31,7 +31,7 @@ you probably needn't concern yourself with pcmciautils.
@@ -112,12 +123,12 @@ index 7ef8de58f7f892..879ee628893ae1 100644
  GNU C                  5.1              gcc --version
  Clang/LLVM (optional)  13.0.1           clang --version
 -Rust (optional)        1.76.0           rustc --version
-+Rust (optional)        1.77.0           rustc --version
++Rust (optional)        1.77.1           rustc --version
  bindgen (optional)     0.65.1           bindgen --version
  GNU make               3.82             make --version
  bash                   4.2              bash --version
 diff --git a/rust/alloc/alloc.rs b/rust/alloc/alloc.rs
-index abb791cc23715a..b1204f87227b23 100644
+index abb791cc2371..b1204f87227b 100644
 --- a/rust/alloc/alloc.rs
 +++ b/rust/alloc/alloc.rs
 @@ -5,7 +5,7 @@
@@ -129,7 +140,7 @@ index abb791cc23715a..b1204f87227b23 100644
  
  #[cfg(not(test))]
  use core::ptr::{self, NonNull};
-@@ -210,7 +210,7 @@ impl Global {
+@@ -210,7 +210,7 @@ unsafe fn grow_impl(
                  let new_size = new_layout.size();
  
                  // `realloc` probably checks for `new_size >= old_layout.size()` or something similar.
@@ -138,7 +149,7 @@ index abb791cc23715a..b1204f87227b23 100644
  
                  let raw_ptr = realloc(ptr.as_ptr(), old_layout, new_size);
                  let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;
-@@ -301,7 +301,7 @@ unsafe impl Allocator for Global {
+@@ -301,7 +301,7 @@ unsafe fn shrink(
              // SAFETY: `new_size` is non-zero. Other conditions must be upheld by the caller
              new_size if old_layout.align() == new_layout.align() => unsafe {
                  // `realloc` probably checks for `new_size <= old_layout.size()` or something similar.
@@ -148,7 +159,7 @@ index abb791cc23715a..b1204f87227b23 100644
                  let raw_ptr = realloc(ptr.as_ptr(), old_layout, new_size);
                  let ptr = NonNull::new(raw_ptr).ok_or(AllocError)?;
 diff --git a/rust/alloc/boxed.rs b/rust/alloc/boxed.rs
-index c93a22a5c97f14..5fc39dfeb8e7bf 100644
+index c93a22a5c97f..5fc39dfeb8e7 100644
 --- a/rust/alloc/boxed.rs
 +++ b/rust/alloc/boxed.rs
 @@ -26,6 +26,7 @@
@@ -159,7 +170,7 @@ index c93a22a5c97f14..5fc39dfeb8e7bf 100644
  //! #[derive(Debug)]
  //! enum List<T> {
  //!     Cons(T, Box<List<T>>),
-@@ -194,8 +195,7 @@ mod thin;
+@@ -194,8 +195,7 @@
  #[fundamental]
  #[stable(feature = "rust1", since = "1.0.0")]
  // The declaration of the `Box` struct must be kept in sync with the
@@ -170,7 +181,7 @@ index c93a22a5c97f14..5fc39dfeb8e7bf 100644
      T: ?Sized,
      #[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
 diff --git a/rust/alloc/lib.rs b/rust/alloc/lib.rs
-index 36f79c07559338..39afd55ec0749e 100644
+index 36f79c075593..39afd55ec074 100644
 --- a/rust/alloc/lib.rs
 +++ b/rust/alloc/lib.rs
 @@ -105,7 +105,6 @@
@@ -223,7 +234,7 @@ index 36f79c07559338..39afd55ec0749e 100644
  #![feature(exclusive_range_pattern)]
  #![feature(fundamental)]
 diff --git a/rust/alloc/raw_vec.rs b/rust/alloc/raw_vec.rs
-index 98b6abf30af6e4..1839d1c8ee7a04 100644
+index 98b6abf30af6..1839d1c8ee7a 100644
 --- a/rust/alloc/raw_vec.rs
 +++ b/rust/alloc/raw_vec.rs
 @@ -4,7 +4,7 @@
@@ -235,7 +246,7 @@ index 98b6abf30af6e4..1839d1c8ee7a04 100644
  use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
  use core::ptr::{self, NonNull, Unique};
  use core::slice;
-@@ -317,7 +317,7 @@ impl<T, A: Allocator> RawVec<T, A> {
+@@ -317,7 +317,7 @@ fn current_memory(&self) -> Option<(NonNull<u8>, Layout)> {
      ///
      /// # Panics
      ///
@@ -244,7 +255,7 @@ index 98b6abf30af6e4..1839d1c8ee7a04 100644
      ///
      /// # Aborts
      ///
-@@ -358,7 +358,7 @@ impl<T, A: Allocator> RawVec<T, A> {
+@@ -358,7 +358,7 @@ pub fn try_reserve(&mut self, len: usize, additional: usize) -> Result<(), TryRe
          }
          unsafe {
              // Inform the optimizer that the reservation has succeeded or wasn't needed
@@ -253,7 +264,7 @@ index 98b6abf30af6e4..1839d1c8ee7a04 100644
          }
          Ok(())
      }
-@@ -381,7 +381,7 @@ impl<T, A: Allocator> RawVec<T, A> {
+@@ -381,7 +381,7 @@ pub fn try_reserve_for_push(&mut self, len: usize) -> Result<(), TryReserveError
      ///
      /// # Panics
      ///
@@ -262,7 +273,7 @@ index 98b6abf30af6e4..1839d1c8ee7a04 100644
      ///
      /// # Aborts
      ///
-@@ -402,7 +402,7 @@ impl<T, A: Allocator> RawVec<T, A> {
+@@ -402,7 +402,7 @@ pub fn try_reserve_exact(
          }
          unsafe {
              // Inform the optimizer that the reservation has succeeded or wasn't needed
@@ -271,7 +282,7 @@ index 98b6abf30af6e4..1839d1c8ee7a04 100644
          }
          Ok(())
      }
-@@ -553,7 +553,7 @@ where
+@@ -553,7 +553,7 @@ fn finish_grow<A>(
          debug_assert_eq!(old_layout.align(), new_layout.align());
          unsafe {
              // The allocator checks for alignment equality
@@ -289,10 +300,10 @@ index 98b6abf30af6e4..1839d1c8ee7a04 100644
  fn alloc_guard(alloc_size: usize) -> Result<(), TryReserveError> {
      if usize::BITS < 64 && alloc_size > isize::MAX as usize {
 diff --git a/rust/alloc/slice.rs b/rust/alloc/slice.rs
-index 1181836da5f462..a36b072c95195f 100644
+index 1181836da5f4..a36b072c9519 100644
 --- a/rust/alloc/slice.rs
 +++ b/rust/alloc/slice.rs
-@@ -53,14 +53,14 @@ pub use core::slice::{from_mut, from_ref};
+@@ -53,14 +53,14 @@
  pub use core::slice::{from_mut_ptr_range, from_ptr_range};
  #[stable(feature = "rust1", since = "1.0.0")]
  pub use core::slice::{from_raw_parts, from_raw_parts_mut};
@@ -310,10 +321,10 @@ index 1181836da5f462..a36b072c95195f 100644
  pub use core::slice::{Iter, IterMut};
  #[stable(feature = "rchunks", since = "1.31.0")]
 diff --git a/rust/alloc/vec/into_iter.rs b/rust/alloc/vec/into_iter.rs
-index 136bfe94af6c83..0f11744c44b34c 100644
+index 136bfe94af6c..0f11744c44b3 100644
 --- a/rust/alloc/vec/into_iter.rs
 +++ b/rust/alloc/vec/into_iter.rs
-@@ -20,6 +20,17 @@ use core::ops::Deref;
+@@ -20,6 +20,17 @@
  use core::ptr::{self, NonNull};
  use core::slice::{self};
  
@@ -357,7 +368,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
      }
  
      /// Returns the remaining items of this iterator as a mutable slice.
-@@ -99,7 +112,7 @@ impl<T, A: Allocator> IntoIter<T, A> {
+@@ -99,7 +112,7 @@ pub fn allocator(&self) -> &A {
      }
  
      fn as_raw_mut_slice(&mut self) -> *mut [T] {
@@ -366,7 +377,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
      }
  
      /// Drops remaining elements and relinquishes the backing allocation.
-@@ -126,7 +139,7 @@ impl<T, A: Allocator> IntoIter<T, A> {
+@@ -126,7 +139,7 @@ pub(super) fn forget_allocation_drop_remaining(&mut self) {
          // this creates less assembly
          self.cap = 0;
          self.buf = unsafe { NonNull::new_unchecked(RawVec::NEW.ptr()) };
@@ -375,7 +386,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
          self.end = self.buf.as_ptr();
  
          // Dropping the remaining elements can panic, so this needs to be
-@@ -138,9 +151,9 @@ impl<T, A: Allocator> IntoIter<T, A> {
+@@ -138,9 +151,9 @@ pub(super) fn forget_allocation_drop_remaining(&mut self) {
  
      /// Forgets to Drop the remaining elements while still allowing the backing allocation to be freed.
      pub(crate) fn forget_remaining_elements(&mut self) {
@@ -387,7 +398,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
      }
  
      #[cfg(not(no_global_oom_handling))]
-@@ -162,7 +175,7 @@ impl<T, A: Allocator> IntoIter<T, A> {
+@@ -162,7 +175,7 @@ pub(crate) fn into_vecdeque(self) -> VecDeque<T, A> {
                  // say that they're all at the beginning of the "allocation".
                  0..this.len()
              } else {
@@ -406,9 +417,6 @@ index 136bfe94af6c83..0f11744c44b34c 100644
 -            // `ptr` has to stay where it is to remain aligned, so we reduce the length by 1 by
 -            // reducing the `end`.
 -            self.end = self.end.wrapping_byte_sub(1);
--
--            // Make up a value of this ZST.
--            Some(unsafe { mem::zeroed() })
 +        if T::IS_ZST {
 +            if self.ptr.as_ptr() == self.end as *mut _ {
 +                None
@@ -416,7 +424,9 @@ index 136bfe94af6c83..0f11744c44b34c 100644
 +                // `ptr` has to stay where it is to remain aligned, so we reduce the length by 1 by
 +                // reducing the `end`.
 +                self.end = self.end.wrapping_byte_sub(1);
-+
+ 
+-            // Make up a value of this ZST.
+-            Some(unsafe { mem::zeroed() })
 +                // Make up a value of this ZST.
 +                Some(unsafe { mem::zeroed() })
 +            }
@@ -446,7 +456,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
          };
          (exact, Some(exact))
      }
-@@ -219,7 +238,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
+@@ -219,7 +238,7 @@ fn size_hint(&self) -> (usize, Option<usize>) {
      #[inline]
      fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
          let step_size = self.len().min(n);
@@ -455,7 +465,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
          if T::IS_ZST {
              // See `next` for why we sub `end` here.
              self.end = self.end.wrapping_byte_sub(step_size);
-@@ -261,7 +280,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
+@@ -261,7 +280,7 @@ fn count(self) -> usize {
              // Safety: `len` indicates that this many elements are available and we just checked that
              // it fits into the array.
              unsafe {
@@ -464,7 +474,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
                  self.forget_remaining_elements();
                  return Err(array::IntoIter::new_unchecked(raw_ary, 0..len));
              }
-@@ -270,7 +289,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
+@@ -270,7 +289,7 @@ fn count(self) -> usize {
          // Safety: `len` is larger than the array size. Copy a fixed amount here to fully initialize
          // the array.
          return unsafe {
@@ -473,7 +483,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
              self.ptr = self.ptr.add(N);
              Ok(raw_ary.transpose().assume_init())
          };
-@@ -288,7 +307,7 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
+@@ -288,7 +307,7 @@ unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item
          // Also note the implementation of `Self: TrustedRandomAccess` requires
          // that `T: Copy` so reading elements from the buffer doesn't invalidate
          // them for `Drop`.
@@ -482,7 +492,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
      }
  }
  
-@@ -296,18 +315,25 @@ impl<T, A: Allocator> Iterator for IntoIter<T, A> {
+@@ -296,18 +315,25 @@ unsafe fn __iterator_get_unchecked(&mut self, i: usize) -> Self::Item
  impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A> {
      #[inline]
      fn next_back(&mut self) -> Option<T> {
@@ -491,16 +501,15 @@ index 136bfe94af6c83..0f11744c44b34c 100644
 -        } else if T::IS_ZST {
 -            // See above for why 'ptr.offset' isn't used
 -            self.end = self.end.wrapping_byte_sub(1);
--
--            // Make up a value of this ZST.
--            Some(unsafe { mem::zeroed() })
 +        if T::IS_ZST {
 +            if self.end as *mut _ == self.ptr.as_ptr() {
 +                None
 +            } else {
 +                // See above for why 'ptr.offset' isn't used
 +                self.end = self.end.wrapping_byte_sub(1);
-+
+ 
+-            // Make up a value of this ZST.
+-            Some(unsafe { mem::zeroed() })
 +                // Make up a value of this ZST.
 +                Some(unsafe { mem::zeroed() })
 +            }
@@ -518,7 +527,7 @@ index 136bfe94af6c83..0f11744c44b34c 100644
          }
      }
  
-@@ -333,7 +359,11 @@ impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A> {
+@@ -333,7 +359,11 @@ fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize> {
  #[stable(feature = "rust1", since = "1.0.0")]
  impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A> {
      fn is_empty(&self) -> bool {
@@ -532,10 +541,10 @@ index 136bfe94af6c83..0f11744c44b34c 100644
  }
  
 diff --git a/rust/alloc/vec/mod.rs b/rust/alloc/vec/mod.rs
-index 220fb9d6f45b3f..0be27fff4554a1 100644
+index 220fb9d6f45b..0be27fff4554 100644
 --- a/rust/alloc/vec/mod.rs
 +++ b/rust/alloc/vec/mod.rs
-@@ -360,7 +360,7 @@ mod spec_extend;
+@@ -360,7 +360,7 @@
  ///
  /// `vec![x; n]`, `vec![a, b, c, d]`, and
  /// [`Vec::with_capacity(n)`][`Vec::with_capacity`], will all produce a `Vec`
@@ -544,7 +553,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
  /// (as is the case for the [`vec!`] macro), then a `Vec<T>` can be converted to
  /// and from a [`Box<[T]>`][owned slice] without reallocating or moving the elements.
  ///
-@@ -447,7 +447,7 @@ impl<T> Vec<T> {
+@@ -447,7 +447,7 @@ pub const fn new() -> Self {
      ///
      /// # Panics
      ///
@@ -553,7 +562,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      ///
      /// # Examples
      ///
-@@ -690,7 +690,7 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -690,7 +690,7 @@ pub const fn new_in(alloc: A) -> Self {
      ///
      /// # Panics
      ///
@@ -562,7 +571,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      ///
      /// # Examples
      ///
-@@ -1013,7 +1013,7 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -1013,7 +1013,7 @@ pub fn capacity(&self) -> usize {
      ///
      /// # Panics
      ///
@@ -571,7 +580,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      ///
      /// # Examples
      ///
-@@ -1043,7 +1043,7 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -1043,7 +1043,7 @@ pub fn reserve(&mut self, additional: usize) {
      ///
      /// # Panics
      ///
@@ -580,7 +589,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      ///
      /// # Examples
      ///
-@@ -1140,8 +1140,11 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -1140,8 +1140,11 @@ pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveE
  
      /// Shrinks the capacity of the vector as much as possible.
      ///
@@ -594,7 +603,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      ///
      /// # Examples
      ///
-@@ -1191,10 +1194,10 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -1191,10 +1194,10 @@ pub fn shrink_to(&mut self, min_capacity: usize) {
  
      /// Converts the vector into [`Box<[T]>`][owned slice].
      ///
@@ -607,7 +616,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      ///
      /// # Examples
      ///
-@@ -2017,7 +2020,7 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -2017,7 +2020,7 @@ fn drop(&mut self) {
      ///
      /// # Panics
      ///
@@ -616,7 +625,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      ///
      /// # Examples
      ///
-@@ -2133,7 +2136,7 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -2133,7 +2136,7 @@ pub fn pop(&mut self) -> Option<T> {
          } else {
              unsafe {
                  self.len -= 1;
@@ -625,7 +634,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
                  Some(ptr::read(self.as_ptr().add(self.len())))
              }
          }
-@@ -2143,7 +2146,7 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -2143,7 +2146,7 @@ pub fn pop(&mut self) -> Option<T> {
      ///
      /// # Panics
      ///
@@ -634,7 +643,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      ///
      /// # Examples
      ///
-@@ -2315,6 +2318,12 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -2315,6 +2318,12 @@ pub fn is_empty(&self) -> bool {
      /// `[at, len)`. After the call, the original vector will be left containing
      /// the elements `[0, at)` with its previous capacity unchanged.
      ///
@@ -647,7 +656,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      /// # Panics
      ///
      /// Panics if `at > len`.
-@@ -2346,14 +2355,6 @@ impl<T, A: Allocator> Vec<T, A> {
+@@ -2346,14 +2355,6 @@ fn assert_failed(at: usize, len: usize) -> ! {
              assert_failed(at, self.len());
          }
  
@@ -662,7 +671,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
          let other_len = self.len - at;
          let mut other = Vec::with_capacity_in(other_len, self.allocator().clone());
  
-@@ -3027,6 +3028,50 @@ impl<T, I: SliceIndex<[T]>, A: Allocator> IndexMut<I> for Vec<T, A> {
+@@ -3027,6 +3028,50 @@ fn index_mut(&mut self, index: I) -> &mut Self::Output {
      }
  }
  
@@ -713,7 +722,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
  #[cfg(not(no_global_oom_handling))]
  #[stable(feature = "rust1", since = "1.0.0")]
  impl<T> FromIterator<T> for Vec<T> {
-@@ -3069,14 +3114,8 @@ impl<T, A: Allocator> IntoIterator for Vec<T, A> {
+@@ -3069,14 +3114,8 @@ fn into_iter(self) -> Self::IntoIter {
                  begin.add(me.len()) as *const T
              };
              let cap = me.buf.capacity();
@@ -730,7 +739,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
          }
      }
  }
-@@ -3598,8 +3637,10 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
+@@ -3598,8 +3637,10 @@ fn from(s: Box<[T], A>) -> Self {
  impl<T, A: Allocator> From<Vec<T, A>> for Box<[T], A> {
      /// Convert a vector into a boxed slice.
      ///
@@ -744,7 +753,7 @@ index 220fb9d6f45b3f..0be27fff4554a1 100644
      /// # Examples
      ///
 diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
-index be68d5e567b1a1..71f95e5aa09abd 100644
+index 6858e2f8a3ed..9e9b245ebab5 100644
 --- a/rust/kernel/lib.rs
 +++ b/rust/kernel/lib.rs
 @@ -16,7 +16,6 @@
@@ -755,17 +764,8 @@ index be68d5e567b1a1..71f95e5aa09abd 100644
  #![feature(receiver_trait)]
  #![feature(unsize)]
  
-@@ -78,7 +77,7 @@ pub trait Module: Sized + Sync {
- /// Equivalent to `THIS_MODULE` in the C API.
- ///
- /// C header: [`include/linux/export.h`](srctree/include/linux/export.h)
--pub struct ThisModule(*mut bindings::module);
-+pub struct ThisModule(#[allow(dead_code)] *mut bindings::module);
- 
- // SAFETY: `THIS_MODULE` may be used from all threads within a module.
- unsafe impl Sync for ThisModule {}
 diff --git a/scripts/Makefile.build b/scripts/Makefile.build
-index baf86c0880b6d7..367cfeea74c5f5 100644
+index 533a7799fdfe..5a6ab6d965bc 100644
 --- a/scripts/Makefile.build
 +++ b/scripts/Makefile.build
 @@ -263,7 +263,7 @@ $(obj)/%.lst: $(src)/%.c FORCE
@@ -778,7 +778,7 @@ index baf86c0880b6d7..367cfeea74c5f5 100644
  # `--out-dir` is required to avoid temporaries being created by `rustc` in the
  # current working directory, which may be not accessible in the out-of-tree
 diff --git a/scripts/min-tool-version.sh b/scripts/min-tool-version.sh
-index 5927cc6b7de338..cc5141b67b4a71 100755
+index 5927cc6b7de3..6086e00e640e 100755
 --- a/scripts/min-tool-version.sh
 +++ b/scripts/min-tool-version.sh
 @@ -33,7 +33,7 @@ llvm)
@@ -786,7 +786,10 @@ index 5927cc6b7de338..cc5141b67b4a71 100755
  	;;
  rustc)
 -	echo 1.76.0
-+	echo 1.77.0
++	echo 1.77.1
  	;;
  bindgen)
  	echo 0.65.1
+-- 
+2.44.0
+
diff --git a/pkgs/os-specific/linux/kernel/xanmod-kernels.nix b/pkgs/os-specific/linux/kernel/xanmod-kernels.nix
index 545bb02e95ec0..b2c4d0a6a6695 100644
--- a/pkgs/os-specific/linux/kernel/xanmod-kernels.nix
+++ b/pkgs/os-specific/linux/kernel/xanmod-kernels.nix
@@ -6,19 +6,20 @@ let
   # NOTE: When updating these, please also take a look at the changes done to
   # kernel config in the xanmod version commit
   ltsVariant = {
-    version = "6.6.32";
-    hash = "sha256-DdBkfDq+bed1WdaAtxX16xjZO10jjqJ74ccY9Wq6ryM=";
+    version = "6.6.33";
+    hash = "sha256-3qGxIYNVm2f69rym0Ya1X497G7yRNj3lLCtVgyEZ9yw=";
     variant = "lts";
   };
 
   mainVariant = {
-    version = "6.8.11";
-    hash = "sha256-nEAUw7qFXab7J6x8coSsoB2meeOX4TQver2WztkFJJI=";
+    version = "6.9.4";
+    hash = "sha256-gY0t77aPWOuRZFESNp0OLIsjLAv+rf0NHbab9WF2VtA=";
     variant = "main";
   };
 
   xanmodKernelFor = { version, suffix ? "xanmod1", hash, variant }: buildLinux (args // rec {
     inherit version;
+    pname = "linux-xanmod";
     modDirVersion = lib.versions.pad 3 "${version}-${suffix}";
 
     src = fetchFromGitHub {
@@ -45,6 +46,14 @@ let
       HZ = freeform "250";
       HZ_250 = yes;
       HZ_1000 = no;
+
+      # RCU_BOOST and RCU_EXP_KTHREAD
+      RCU_EXPERT = yes;
+      RCU_FANOUT = freeform "64";
+      RCU_FANOUT_LEAF = freeform "16";
+      RCU_BOOST = yes;
+      RCU_BOOST_DELAY = freeform "0";
+      RCU_EXP_KTHREAD = yes;
     };
 
     extraMeta = {
diff --git a/pkgs/os-specific/linux/kernel/zen-kernels.nix b/pkgs/os-specific/linux/kernel/zen-kernels.nix
index 072416007e728..270a608c84cd5 100644
--- a/pkgs/os-specific/linux/kernel/zen-kernels.nix
+++ b/pkgs/os-specific/linux/kernel/zen-kernels.nix
@@ -4,20 +4,21 @@ let
   # comments with variant added for update script
   # ./update-zen.py zen
   zenVariant = {
-    version = "6.9.3"; #zen
+    version = "6.9.5"; #zen
     suffix = "zen1"; #zen
-    sha256 = "0vgy249zrzm6kn8wqisnbgbq8h6sffmk1zs6cx57annab9w0sb57"; #zen
+    sha256 = "16dm07xd5x5kbn3yk8q2kqwby67953p40ja0akrg31hycz8sgbqq"; #zen
     isLqx = false;
   };
   # ./update-zen.py lqx
   lqxVariant = {
-    version = "6.9.3"; #lqx
+    version = "6.9.5"; #lqx
     suffix = "lqx1"; #lqx
-    sha256 = "1wfjw5fq7myvhfb6srina0b7b76a08ib9x8hd8bdfr4zr6al8zq8"; #lqx
+    sha256 = "0r3pgjfyza3vkvp7kw1s7sn1gf4hxq6r6qs5wvv76gmff7s399yz"; #lqx
     isLqx = true;
   };
   zenKernelsFor = { version, suffix, sha256, isLqx }: buildLinux (args // {
     inherit version;
+    pname = "linux-${if isLqx then "lqx" else "zen"}";
     modDirVersion = lib.versions.pad 3 "${version}-${suffix}";
     isZen = true;
 
diff --git a/pkgs/os-specific/linux/kexec-tools/default.nix b/pkgs/os-specific/linux/kexec-tools/default.nix
index 530fd767bb909..fb5911a68053c 100644
--- a/pkgs/os-specific/linux/kexec-tools/default.nix
+++ b/pkgs/os-specific/linux/kexec-tools/default.nix
@@ -18,7 +18,12 @@ stdenv.mkDerivation rec {
       url = "https://raw.githubusercontent.com/void-linux/void-packages/6c1192cbf166698932030c2e3de71db1885a572d/srcpkgs/kexec-tools/patches/ppc64-elfv2.patch";
       sha256 = "19wzfwb0azm932v0vhywv4221818qmlmvdfwpvvpfyw4hjsc2s1l";
     })
-  ];
+    # binutils-2.42 support
+    (fetchpatch {
+      url = "https://github.com/horms/kexec-tools/commit/328de8e00e298f00d7ba6b25dc3950147e9642e6.patch";
+      hash = "sha256-wVQI4oV+hBLq3kGIp2+F5J3f6s/TypDu3Xq583KYc3U=";
+    })
+  ] ++ lib.optional (stdenv.hostPlatform.useLLVM or false) ./fix-purgatory-llvm-libunwind.patch;
 
   hardeningDisable = [ "format" "pic" "relro" "pie" ];
 
@@ -38,6 +43,6 @@ stdenv.mkDerivation rec {
       "riscv64-linux" "riscv32-linux"
       "sparc-linux" "sparc64-linux"
     ];
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
   };
 }
diff --git a/pkgs/os-specific/linux/kexec-tools/fix-purgatory-llvm-libunwind.patch b/pkgs/os-specific/linux/kexec-tools/fix-purgatory-llvm-libunwind.patch
new file mode 100644
index 0000000000000..235410da94f2c
--- /dev/null
+++ b/pkgs/os-specific/linux/kexec-tools/fix-purgatory-llvm-libunwind.patch
@@ -0,0 +1,11 @@
+--- a/purgatory/Makefile	2024-06-06 23:59:33.089005832 -0700
++++ b/purgatory/Makefile	2024-06-06 23:59:56.761169892 -0700
+@@ -62,7 +62,7 @@
+ $(PURGATORY): LDFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS)\
+ 			-Wl,--no-undefined -nostartfiles -nostdlib \
+ 			-nodefaultlibs -e purgatory_start -r \
+-			-Wl,-Map=$(PURGATORY_MAP)
++			-Wl,-Map=$(PURGATORY_MAP) -static
+ 
+ $(PURGATORY): $(PURGATORY_OBJS)
+ 	$(MKDIR) -p $(@D)
diff --git a/pkgs/os-specific/linux/ksmbd-tools/default.nix b/pkgs/os-specific/linux/ksmbd-tools/default.nix
index b81f581c07aaa..fa4bdbd9e66d5 100644
--- a/pkgs/os-specific/linux/ksmbd-tools/default.nix
+++ b/pkgs/os-specific/linux/ksmbd-tools/default.nix
@@ -35,8 +35,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Userspace utilities for the ksmbd kernel SMB server";
     homepage = "https://www.kernel.org/doc/html/latest/filesystems/cifs/ksmbd.html";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
-    maintainers = with maintainers; [ elohmeier ];
   };
 }
diff --git a/pkgs/os-specific/linux/latencytop/default.nix b/pkgs/os-specific/linux/latencytop/default.nix
index 023140e1f482b..43d1fddde9272 100644
--- a/pkgs/os-specific/linux/latencytop/default.nix
+++ b/pkgs/os-specific/linux/latencytop/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     homepage = "http://latencytop.org";
     description = "Tool to show kernel reports on latencies (LATENCYTOP option)";
     mainProgram = "latencytop";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     maintainers = [ lib.maintainers.viric ];
     platforms = lib.platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/libbpf/default.nix b/pkgs/os-specific/linux/libbpf/default.nix
index 6a0ee908347ca..032283711cf38 100644
--- a/pkgs/os-specific/linux/libbpf/default.nix
+++ b/pkgs/os-specific/linux/libbpf/default.nix
@@ -14,13 +14,13 @@
 
 stdenv.mkDerivation rec {
   pname = "libbpf";
-  version = "1.4.2";
+  version = "1.4.3";
 
   src = fetchFromGitHub {
     owner = "libbpf";
     repo = "libbpf";
     rev = "v${version}";
-    sha256 = "sha256-PlGr/qZbKnaY37wikdmX/iYtP11WHShn1I7vACUgLG0=";
+    sha256 = "sha256-lcIOgghlBKrDCBDdO0hryjt8KADQd6aroQMun3ein2o=";
   };
 
   nativeBuildInputs = [ pkg-config ];
diff --git a/pkgs/os-specific/linux/libpsm2/default.nix b/pkgs/os-specific/linux/libpsm2/default.nix
index 96fa03cf8b056..ee47968352ae4 100644
--- a/pkgs/os-specific/linux/libpsm2/default.nix
+++ b/pkgs/os-specific/linux/libpsm2/default.nix
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://github.com/intel/opa-psm2";
     description = "PSM2 library supports a number of fabric media and stacks";
-    license = with licenses; [ gpl2 bsd3 ];
+    license = with licenses; [ gpl2Only bsd3 ];
     platforms = [ "x86_64-linux" ];
     maintainers = [ maintainers.bzizou ];
   };
diff --git a/pkgs/os-specific/linux/libvolume_id/default.nix b/pkgs/os-specific/linux/libvolume_id/default.nix
index 653094c91884f..718bd9cec89ca 100644
--- a/pkgs/os-specific/linux/libvolume_id/default.nix
+++ b/pkgs/os-specific/linux/libvolume_id/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     platforms = platforms.linux;
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     homepage = "http://www.marcuscom.com/downloads/";
   };
 }
diff --git a/pkgs/os-specific/linux/lightum/default.nix b/pkgs/os-specific/linux/lightum/default.nix
index 46dd76e0d277d..f1f95d5563b01 100644
--- a/pkgs/os-specific/linux/lightum/default.nix
+++ b/pkgs/os-specific/linux/lightum/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation {
     description = "MacBook automatic light sensor daemon";
     mainProgram = "lightum";
     homepage = "https://github.com/poliva/lightum";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Plus;
     maintainers = with lib.maintainers; [ puffnfresh ];
     platforms = lib.platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/liquidtux/default.nix b/pkgs/os-specific/linux/liquidtux/default.nix
index 317801bb3cddb..ca4fb27c8f199 100644
--- a/pkgs/os-specific/linux/liquidtux/default.nix
+++ b/pkgs/os-specific/linux/liquidtux/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Linux kernel hwmon drivers for AIO liquid coolers and other devices";
     homepage = "https://github.com/liquidctl/liquidtux";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = [ "x86_64-linux" "i686-linux" ];
     maintainers = with maintainers; [ nickhu ];
     broken = lib.versionOlder kernel.version "5.10";
diff --git a/pkgs/os-specific/linux/lksctp-tools/default.nix b/pkgs/os-specific/linux/lksctp-tools/default.nix
index 24915143fbd0d..f6a91c663a05d 100644
--- a/pkgs/os-specific/linux/lksctp-tools/default.nix
+++ b/pkgs/os-specific/linux/lksctp-tools/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Linux Kernel Stream Control Transmission Protocol Tools";
     homepage = "https://lksctp.sourceforge.net/";
-    license = with licenses; [ gpl2 lgpl21 ]; # library is lgpl21
+    license = with licenses; [ gpl2Plus lgpl21 ]; # library is lgpl21
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/lockdep/default.nix b/pkgs/os-specific/linux/lockdep/default.nix
index be3967f0a8587..971ba71d8a759 100644
--- a/pkgs/os-specific/linux/lockdep/default.nix
+++ b/pkgs/os-specific/linux/lockdep/default.nix
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
     description = "Userspace locking validation tool built on the Linux kernel";
     mainProgram = "lockdep";
     homepage    = "https://kernel.org/";
-    license     = lib.licenses.gpl2;
+    license     = lib.licenses.gpl2Only;
     platforms   = lib.platforms.linux;
     maintainers = [ lib.maintainers.thoughtpolice ];
   };
diff --git a/pkgs/os-specific/linux/lsscsi/default.nix b/pkgs/os-specific/linux/lsscsi/default.nix
index d87820f246649..11826a105669e 100644
--- a/pkgs/os-specific/linux/lsscsi/default.nix
+++ b/pkgs/os-specific/linux/lsscsi/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = with lib; {
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/lvm2/common.nix b/pkgs/os-specific/linux/lvm2/common.nix
index caafa52a81738..9cba67ee2b39d 100644
--- a/pkgs/os-specific/linux/lvm2/common.nix
+++ b/pkgs/os-specific/linux/lvm2/common.nix
@@ -155,7 +155,7 @@ stdenv.mkDerivation rec {
     homepage = "http://sourceware.org/lvm2/";
     description = "Tools to support Logical Volume Management (LVM) on Linux";
     platforms = platforms.linux;
-    license = with licenses; [ gpl2 bsd2 lgpl21 ];
+    license = with licenses; [ gpl2Only bsd2 lgpl21 ];
     maintainers = with maintainers; [ raskin ajs124 ] ++ teams.helsinki-systems.members;
   };
 }
diff --git a/pkgs/os-specific/linux/mba6x_bl/default.nix b/pkgs/os-specific/linux/mba6x_bl/default.nix
index 3add5eb227f5e..47466dc54051a 100644
--- a/pkgs/os-specific/linux/mba6x_bl/default.nix
+++ b/pkgs/os-specific/linux/mba6x_bl/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
   meta = with lib; {
     description = "MacBook Air 6,1 and 6,2 (mid 2013) backlight driver";
     homepage = "https://github.com/patjak/mba6x_bl";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
     maintainers = [ maintainers.simonvandel ];
   };
diff --git a/pkgs/os-specific/linux/mceinject/default.nix b/pkgs/os-specific/linux/mceinject/default.nix
index c7c8508cb41bb..01d230e3335a9 100644
--- a/pkgs/os-specific/linux/mceinject/default.nix
+++ b/pkgs/os-specific/linux/mceinject/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
       kernel machine check handler.
     '';
     homepage = "https://github.com/andikleen/mce-inject/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ arkivm ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/mdadm/default.nix b/pkgs/os-specific/linux/mdadm/default.nix
index 7150930cb5619..cc26b020235e8 100644
--- a/pkgs/os-specific/linux/mdadm/default.nix
+++ b/pkgs/os-specific/linux/mdadm/default.nix
@@ -64,7 +64,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Programs for managing RAID arrays under Linux";
     homepage = "https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     mainProgram = "mdadm";
     maintainers = with maintainers; [ ekleog ];
     platforms = platforms.linux;
diff --git a/pkgs/os-specific/linux/metastore/default.nix b/pkgs/os-specific/linux/metastore/default.nix
index 76e4ae8932876..999c771fcfafb 100644
--- a/pkgs/os-specific/linux/metastore/default.nix
+++ b/pkgs/os-specific/linux/metastore/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     description = "Store and restore metadata from a filesystem";
     mainProgram = "metastore";
     homepage = "https://software.przemoc.net/#metastore";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ sstef ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/microcode/iucode-tool.nix b/pkgs/os-specific/linux/microcode/iucode-tool.nix
index 316aaa22932dc..d38fa0a488950 100644
--- a/pkgs/os-specific/linux/microcode/iucode-tool.nix
+++ b/pkgs/os-specific/linux/microcode/iucode-tool.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     description = "Intel® 64 and IA-32 processor microcode tool";
     mainProgram = "iucode_tool";
     homepage = "https://gitlab.com/iucode-tool/iucode-tool";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ peterhoeg ];
     platforms = [ "x86_64-linux" "i686-linux" ];
   };
diff --git a/pkgs/os-specific/linux/mingetty/default.nix b/pkgs/os-specific/linux/mingetty/default.nix
index eff1bf50a361e..bbae8f73e316a 100644
--- a/pkgs/os-specific/linux/mingetty/default.nix
+++ b/pkgs/os-specific/linux/mingetty/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     homepage = "https://sourceforge.net/projects/mingetty";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix
index 6addd11554d08..965803c40d8f8 100644
--- a/pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix
+++ b/pkgs/os-specific/linux/minimal-bootstrap/linux-headers/default.nix
@@ -33,7 +33,7 @@ bash.runCommand "${pname}-${version}" {
 
   meta = with lib; {
     description = "Header files and scripts for Linux kernel";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = teams.minimal-bootstrap.members;
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix b/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix
index da2ba4b9ff2de..0e7bb127dbb9a 100644
--- a/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix
+++ b/pkgs/os-specific/linux/mkinitcpio-nfs-utils/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://archlinux.org/";
     description = "ipconfig and nfsmount tools for root on NFS, ported from klibc";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms  = platforms.linux;
     maintainers = with maintainers; [ abbradar ];
   };
diff --git a/pkgs/os-specific/linux/msr-tools/default.nix b/pkgs/os-specific/linux/msr-tools/default.nix
index 1e6a55a4d6560..a96a74c764c4e 100644
--- a/pkgs/os-specific/linux/msr-tools/default.nix
+++ b/pkgs/os-specific/linux/msr-tools/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     description = "Tool to read/write from/to MSR CPU registers on Linux";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ peterhoeg ];
   };
diff --git a/pkgs/os-specific/linux/mstpd/default.nix b/pkgs/os-specific/linux/mstpd/default.nix
index 389acdf91e6e9..0f82fb8fcbdd4 100644
--- a/pkgs/os-specific/linux/mstpd/default.nix
+++ b/pkgs/os-specific/linux/mstpd/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Multiple Spanning Tree Protocol daemon";
     homepage = "https://github.com/mstpd/mstpd";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/multipath-tools/default.nix b/pkgs/os-specific/linux/multipath-tools/default.nix
index ebb8cc03d37c0..9fe8630e22757 100644
--- a/pkgs/os-specific/linux/multipath-tools/default.nix
+++ b/pkgs/os-specific/linux/multipath-tools/default.nix
@@ -35,8 +35,7 @@ stdenv.mkDerivation rec {
     # Backport build fix for musl libc 1.2.5
     (fetchpatch {
       url = "https://github.com/openSUSE/multipath-tools/commit/e5004de8296cd596aeeac0a61b901e98cf7a69d2.patch";
-      hash = "sha256-ZvNFVphB9f+S/XMxktR6P/YYSTLeJXEsj4XrAnw6GUI=";
-      excludes = ["tests/util.c"];
+      hash = "sha256-3Qt8zfrWi9aOdqMObZQaNAaXDmjhvSYrXK7qycC9L1Q=";
     })
   ];
 
@@ -46,16 +45,6 @@ stdenv.mkDerivation rec {
 
     substituteInPlace multipathd/multipathd.service.in \
       --replace-fail /sbin/multipathd "$out/bin/multipathd"
-
-    sed -i -re '
-      s,^( *#define +DEFAULT_MULTIPATHDIR\>).*,\1 "'"$out/lib/multipath"'",
-    ' libmultipath/defaults.h
-    sed -i -e 's,\$(DESTDIR)/\(usr/\)\?,$(prefix)/,g' \
-      kpartx/Makefile libmpathpersist/Makefile
-    sed -i -e "s,GZIP,GZ," \
-      $(find * -name Makefile\*)
-
-    sed '1i#include <assert.h>' -i tests/{util,vpd}.c
   '';
 
   nativeBuildInputs = [
@@ -95,7 +84,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Tools for the Linux multipathing storage driver";
     homepage = "http://christophe.varoqui.free.fr/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/netatop/default.nix b/pkgs/os-specific/linux/netatop/default.nix
index 68386173ed505..b1a9d244a8d85 100644
--- a/pkgs/os-specific/linux/netatop/default.nix
+++ b/pkgs/os-specific/linux/netatop/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
     description = "Network monitoring module for atop";
     mainProgram = "netatopd";
     homepage = "https://www.atoptool.nl/downloadnetatop.php";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     platforms = lib.platforms.linux;
     maintainers = with lib.maintainers; [ viric ];
   };
diff --git a/pkgs/os-specific/linux/nfs-utils/default.nix b/pkgs/os-specific/linux/nfs-utils/default.nix
index 4fde1dcf910d8..88a4f33b2f3f0 100644
--- a/pkgs/os-specific/linux/nfs-utils/default.nix
+++ b/pkgs/os-specific/linux/nfs-utils/default.nix
@@ -124,7 +124,7 @@ stdenv.mkDerivation rec {
     '';
 
     homepage = "https://linux-nfs.org/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ abbradar ];
   };
diff --git a/pkgs/os-specific/linux/nsncd/default.nix b/pkgs/os-specific/linux/nsncd/default.nix
index 9491c4887fce6..80dfdb5457fa7 100644
--- a/pkgs/os-specific/linux/nsncd/default.nix
+++ b/pkgs/os-specific/linux/nsncd/default.nix
@@ -7,16 +7,16 @@
 
 rustPlatform.buildRustPackage rec {
   pname = "nsncd";
-  version = "unstable-2024-01-16";
+  version = "unstable-2024-03-18";
 
   src = fetchFromGitHub {
     owner = "twosigma";
     repo = "nsncd";
-    rev =  "f4706786f26d12c533035fb2916be9be5751150b";
-    hash = "sha256-GbKDWW00eZZwmslkaGIO8hjCyD5xi7h+S2WP6q5ekOQ=";
+    rev =  "7605e330d5a313a8656e6fcaf1c10cd6b5cdd427";
+    hash = "sha256-Bd7qE9MP5coBCkr70TdoJfwYhQpdrn/zmN4KoARcaMI=";
   };
 
-  cargoSha256 = "sha256-jAxcyMPDTBFBrG0cuKm0Tm5p/UEnUgTPQKDgqY2yK7w=";
+  cargoHash = "sha256-i1rmc5wxtc631hZy2oM4d6r7od0w8GrG7+/pdM6Gqco=";
   checkFlags = [
     # Relies on the test environment to be able to resolve "localhost"
     # on IPv4. That's not the case in the Nix sandbox somehow. Works
diff --git a/pkgs/os-specific/linux/nss_ldap/default.nix b/pkgs/os-specific/linux/nss_ldap/default.nix
index 7366932d1e676..784ecf2b39cce 100644
--- a/pkgs/os-specific/linux/nss_ldap/default.nix
+++ b/pkgs/os-specific/linux/nss_ldap/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     description = "LDAP module for the Solaris Nameservice Switch (NSS)";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/numactl/default.nix b/pkgs/os-specific/linux/numactl/default.nix
index 16e2ae51f9572..142dd064e0f91 100644
--- a/pkgs/os-specific/linux/numactl/default.nix
+++ b/pkgs/os-specific/linux/numactl/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Library and tools for non-uniform memory access (NUMA) machines";
     homepage = "https://github.com/numactl/numactl";
-    license = with licenses; [ gpl2 lgpl21 ]; # libnuma is lgpl21
+    license = with licenses; [ gpl2Only lgpl21 ]; # libnuma is lgpl21
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/nvidiabl/default.nix b/pkgs/os-specific/linux/nvidiabl/default.nix
index 0f4d485a4edc6..68991e1289598 100644
--- a/pkgs/os-specific/linux/nvidiabl/default.nix
+++ b/pkgs/os-specific/linux/nvidiabl/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Linux driver for setting the backlight brightness on laptops using NVIDIA GPU";
     homepage = "https://github.com/yorickvP/nvidiabl";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = [ "x86_64-linux" "i686-linux" ];
     maintainers = with maintainers; [ yorickvp ];
     broken = kernel.kernelAtLeast "5.18";
diff --git a/pkgs/os-specific/linux/pam_ccreds/default.nix b/pkgs/os-specific/linux/pam_ccreds/default.nix
index 359636e742814..1921193d70311 100644
--- a/pkgs/os-specific/linux/pam_ccreds/default.nix
+++ b/pkgs/os-specific/linux/pam_ccreds/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     homepage = "https://www.padl.com/OSS/pam_ccreds.html";
     description = "PAM module to locally authenticate using an enterprise identity when the network is unavailable";
     mainProgram = "ccreds_chkpwd";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/pam_mount/default.nix b/pkgs/os-specific/linux/pam_mount/default.nix
index 2ed6829f3614a..81199cb057c69 100644
--- a/pkgs/os-specific/linux/pam_mount/default.nix
+++ b/pkgs/os-specific/linux/pam_mount/default.nix
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "PAM module to mount volumes for a user session";
     homepage = "https://pam-mount.sourceforge.net/";
-    license = with licenses; [ gpl2 gpl3 lgpl21 lgpl3 ];
+    license = with licenses; [ gpl2Plus gpl3 lgpl21 lgpl3 ];
     maintainers = with maintainers; [ netali ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/paxctl/default.nix b/pkgs/os-specific/linux/paxctl/default.nix
index 2f68fa3dc0ccc..e15b17378d9ee 100644
--- a/pkgs/os-specific/linux/paxctl/default.nix
+++ b/pkgs/os-specific/linux/paxctl/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     description = "Tool for controlling PaX flags on a per binary basis";
     mainProgram = "paxctl";
     homepage    = "https://pax.grsecurity.net";
-    license     = licenses.gpl2;
+    license     = licenses.gpl2Only;
     platforms   = platforms.all;
     maintainers = with maintainers; [ thoughtpolice ];
   };
diff --git a/pkgs/os-specific/linux/paxtest/default.nix b/pkgs/os-specific/linux/paxtest/default.nix
index acea7cbe49f77..b415970a743ef 100644
--- a/pkgs/os-specific/linux/paxtest/default.nix
+++ b/pkgs/os-specific/linux/paxtest/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Test various memory protection measures";
     mainProgram = "paxtest";
-    license     = licenses.gpl2;
+    license     = licenses.gpl2Only;
     platforms   = platforms.linux;
     maintainers = with maintainers; [ copumpkin joachifm ];
   };
diff --git a/pkgs/os-specific/linux/pcmciautils/default.nix b/pkgs/os-specific/linux/pcmciautils/default.nix
index b5f9d8a0a2c24..bcfb101c6fcb5 100644
--- a/pkgs/os-specific/linux/pcmciautils/default.nix
+++ b/pkgs/os-specific/linux/pcmciautils/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
       the PCMCIA subsystem to behave (almost) as every other
       hotpluggable bus system.
     ";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/phc-intel/default.nix b/pkgs/os-specific/linux/phc-intel/default.nix
index a0d43b2e0e367..a2e2456ad6e09 100644
--- a/pkgs/os-specific/linux/phc-intel/default.nix
+++ b/pkgs/os-specific/linux/phc-intel/default.nix
@@ -45,7 +45,7 @@ in stdenv.mkDerivation rec {
       Intel architectures.
     '';
     homepage = "https://github.com/danielw86dev/phc-intel-dkms";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = [ "x86_64-linux" "i686-linux" ];
     broken = lib.versionAtLeast kernel.version "4.18";
   };
diff --git a/pkgs/os-specific/linux/piper/default.nix b/pkgs/os-specific/linux/piper/default.nix
index dcdc7a363e30e..d646f004893c2 100644
--- a/pkgs/os-specific/linux/piper/default.nix
+++ b/pkgs/os-specific/linux/piper/default.nix
@@ -35,7 +35,7 @@ python3.pkgs.buildPythonApplication rec {
     description = "GTK frontend for ratbagd mouse config daemon";
     mainProgram = "piper";
     homepage    = "https://github.com/libratbag/piper";
-    license     = licenses.gpl2;
+    license     = licenses.gpl2Only;
     maintainers = with maintainers; [ mvnetbiz ];
     platforms   = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/pm-utils/default.nix b/pkgs/os-specific/linux/pm-utils/default.nix
index 9f2eee83d60bf..3eccb6381cd17 100644
--- a/pkgs/os-specific/linux/pm-utils/default.nix
+++ b/pkgs/os-specific/linux/pm-utils/default.nix
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://pm-utils.freedesktop.org/wiki/";
     description = "Small collection of scripts that handle suspend and resume on behalf of HAL";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Plus;
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/pmount/default.nix b/pkgs/os-specific/linux/pmount/default.nix
index 8267a2d4a7f9d..94ab7b7e3c2db 100644
--- a/pkgs/os-specific/linux/pmount/default.nix
+++ b/pkgs/os-specific/linux/pmount/default.nix
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "https://bazaar.launchpad.net/~fourmond/pmount/main/files";
     description = "Mount removable devices as normal user";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/policycoreutils/default.nix b/pkgs/os-specific/linux/policycoreutils/default.nix
index 5fdb3583b5cf4..bcb5dafa137b6 100644
--- a/pkgs/os-specific/linux/policycoreutils/default.nix
+++ b/pkgs/os-specific/linux/policycoreutils/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     description = "SELinux policy core utilities";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     inherit (libsepol.meta) homepage platforms maintainers;
   };
 }
diff --git a/pkgs/os-specific/linux/pommed-light/default.nix b/pkgs/os-specific/linux/pommed-light/default.nix
index eb5a1b1b0edbd..11a5cebc76bfb 100644
--- a/pkgs/os-specific/linux/pommed-light/default.nix
+++ b/pkgs/os-specific/linux/pommed-light/default.nix
@@ -71,6 +71,6 @@ stdenv.mkDerivation rec {
     '';
     homepage = "https://github.com/bytbox/pommed-light";
     platforms = [ "x86_64-linux" ];
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
   };
 }
diff --git a/pkgs/os-specific/linux/power-calibrate/default.nix b/pkgs/os-specific/linux/power-calibrate/default.nix
index d2ce5d4d4fa7e..24f7f7f419c13 100644
--- a/pkgs/os-specific/linux/power-calibrate/default.nix
+++ b/pkgs/os-specific/linux/power-calibrate/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     description = "Tool to calibrate power consumption";
     mainProgram = "power-calibrate";
     homepage = "https://github.com/ColinIanKing/power-calibrate";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ dtzWill ];
   };
diff --git a/pkgs/os-specific/linux/powerstat/default.nix b/pkgs/os-specific/linux/powerstat/default.nix
index 83f0aa634efa9..b7a88a0d9ec9d 100644
--- a/pkgs/os-specific/linux/powerstat/default.nix
+++ b/pkgs/os-specific/linux/powerstat/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     description = "Laptop power measuring tool";
     mainProgram = "powerstat";
     homepage = "https://github.com/ColinIanKing/powerstat";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ womfoo ];
   };
diff --git a/pkgs/os-specific/linux/procps-ng/default.nix b/pkgs/os-specific/linux/procps-ng/default.nix
index e4d245fdc7ce1..70df91d31eee3 100644
--- a/pkgs/os-specific/linux/procps-ng/default.nix
+++ b/pkgs/os-specific/linux/procps-ng/default.nix
@@ -65,7 +65,7 @@ stdenv.mkDerivation rec {
     homepage = "https://gitlab.com/procps-ng/procps";
     description = "Utilities that give information about processes using the /proc filesystem";
     priority = 11; # less than coreutils, which also provides "kill" and "uptime"
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.unix;
     maintainers = [ maintainers.typetetris ];
   };
diff --git a/pkgs/os-specific/linux/pscircle/default.nix b/pkgs/os-specific/linux/pscircle/default.nix
index 712eea0c3651e..b34a2d7914b32 100644
--- a/pkgs/os-specific/linux/pscircle/default.nix
+++ b/pkgs/os-specific/linux/pscircle/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     homepage = "https://gitlab.com/mildlyparallel/pscircle";
     description = "Visualize Linux processes in a form of a radial tree";
     mainProgram = "pscircle";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = [ maintainers.ldesgoui ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/r8168/default.nix b/pkgs/os-specific/linux/r8168/default.nix
index 6eb53ca17f7a3..274fcd06ffefa 100644
--- a/pkgs/os-specific/linux/r8168/default.nix
+++ b/pkgs/os-specific/linux/r8168/default.nix
@@ -6,18 +6,18 @@ let modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/wi
 in stdenv.mkDerivation rec {
   name = "r8168-${kernel.version}-${version}";
   # on update please verify that the source matches the realtek version
-  version = "8.052.01";
+  version = "8.053.00";
 
   # This is a mirror. The original website[1] doesn't allow non-interactive
   # downloads, instead emailing you a download link.
-  # [1] https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software
-  # I've verified manually (`diff -r`) that the source code for version 8.052.01
+  # [1] https://www.realtek.com/Download/List?cate_id=584
+  # I've verified manually (`diff -r`) that the source code for version 8.053.00
   # is the same as the one available on the realtek website.
   src = fetchFromGitHub {
     owner = "mtorromeo";
     repo = "r8168";
     rev = version;
-    sha256 = "01mi7hh92nc7jaxkfrpz7j0ci78djrhgmq0im4k1270mwmvr0yzj";
+    sha256 = "0bHGs8jyWd+ZiixOoNkBqhS9RjDpRp3vveAgk1YuOWU=";
   };
 
   hardeningDisable = [ "pic" ];
@@ -53,7 +53,7 @@ in stdenv.mkDerivation rec {
     '';
     license = licenses.gpl2Plus;
     platforms = platforms.linux;
-    maintainers = with maintainers; [ timokau ];
-    broken = (lib.versions.majorMinor kernel.modDirVersion) != "5.15";
+    maintainers = with maintainers; [];
+    broken = lib.versionAtLeast kernel.modDirVersion "6.9";
   };
 }
diff --git a/pkgs/os-specific/linux/rewritefs/default.nix b/pkgs/os-specific/linux/rewritefs/default.nix
index e78d5f2d164c8..0626fc0a91a7e 100644
--- a/pkgs/os-specific/linux/rewritefs/default.nix
+++ b/pkgs/os-specific/linux/rewritefs/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
     description = ''A FUSE filesystem intended to be used
       like Apache mod_rewrite'';
     homepage    = "https://github.com/sloonz/rewritefs";
-    license     = licenses.gpl2;
+    license     = licenses.gpl2Only;
     maintainers = with maintainers; [ rnhmjoj ];
     platforms   = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/rt-tests/default.nix b/pkgs/os-specific/linux/rt-tests/default.nix
index a9e3e57d48752..16970a15b1d81 100644
--- a/pkgs/os-specific/linux/rt-tests/default.nix
+++ b/pkgs/os-specific/linux/rt-tests/default.nix
@@ -29,6 +29,6 @@ stdenv.mkDerivation rec {
     description = "Suite of real-time tests - cyclictest, hwlatdetect, pip_stress, pi_stress, pmqtest, ptsematest, rt-migrate-test, sendme, signaltest, sigwaittest, svsematest";
     platforms = platforms.linux;
     maintainers = with maintainers; [ poelzi ];
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
   };
 }
diff --git a/pkgs/os-specific/linux/rtl8189es/default.nix b/pkgs/os-specific/linux/rtl8189es/default.nix
index 553c6a309682e..8e95ceafd3367 100644
--- a/pkgs/os-specific/linux/rtl8189es/default.nix
+++ b/pkgs/os-specific/linux/rtl8189es/default.nix
@@ -38,8 +38,8 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Driver for Realtek rtl8189es";
     homepage = "https://github.com/jwrdegoede/rtl8189ES_linux";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
-    maintainers = with maintainers; [ danielfullmer lheckemann ];
+    maintainers = with maintainers; [ danielfullmer ];
   };
 }
diff --git a/pkgs/os-specific/linux/rtl8189fs/default.nix b/pkgs/os-specific/linux/rtl8189fs/default.nix
index 5f806069daf97..87b0944c4d326 100644
--- a/pkgs/os-specific/linux/rtl8189fs/default.nix
+++ b/pkgs/os-specific/linux/rtl8189fs/default.nix
@@ -15,7 +15,7 @@ rtl8189es.overrideAttrs (drv: rec {
   meta = with lib; {
     description = "Driver for Realtek rtl8189fs";
     homepage = "https://github.com/jwrdegoede/rtl8189ES_linux/tree/rtl8189fs";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
     maintainers = with maintainers; [ puffnfresh ];
   };
diff --git a/pkgs/os-specific/linux/rtl88x2bu/default.nix b/pkgs/os-specific/linux/rtl88x2bu/default.nix
index edb2feed6c619..91ed7cf9b4905 100644
--- a/pkgs/os-specific/linux/rtl88x2bu/default.nix
+++ b/pkgs/os-specific/linux/rtl88x2bu/default.nix
@@ -1,14 +1,20 @@
-{ lib, stdenv, fetchFromGitHub, kernel, bc }:
+{
+  lib,
+  stdenv,
+  fetchFromGitHub,
+  kernel,
+  bc,
+}:
 
 stdenv.mkDerivation {
   pname = "rtl88x2bu";
-  version = "${kernel.version}-unstable-2023-11-29";
+  version = "${kernel.version}-unstable-2024-06-09";
 
   src = fetchFromGitHub {
     owner = "morrownr";
     repo = "88x2bu-20210702";
-    rev = "cd2b6cbd9c8fbfebee8a1f28fab8e4434450456c";
-    sha256 = "sha256-t1lLJSEDzY2zvgcKYaxUq/umrlLpxu4+4zWmG8R0Wz4=";
+    rev = "62f3a86a2687fe98bd441e0aff5adf87d95c238a";
+    hash = "sha256-gQWk1nhtT0W2dY5uQitWabBGEDfZpmJAoJg+j2ndO00=";
   };
 
   hardeningDisable = [ "pic" ];
diff --git a/pkgs/os-specific/linux/schedtool/default.nix b/pkgs/os-specific/linux/schedtool/default.nix
index d3d009db1714b..0ee35df74449e 100644
--- a/pkgs/os-specific/linux/schedtool/default.nix
+++ b/pkgs/os-specific/linux/schedtool/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     description = "Query or alter a process' scheduling policy under Linux";
     mainProgram = "schedtool";
     homepage = "https://freequaos.host.sk/schedtool/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
     maintainers = with maintainers; [ abbradar ];
   };
diff --git a/pkgs/os-specific/linux/sd-switch/default.nix b/pkgs/os-specific/linux/sd-switch/default.nix
index dc25cb434e9d9..b8dfd36d5919c 100644
--- a/pkgs/os-specific/linux/sd-switch/default.nix
+++ b/pkgs/os-specific/linux/sd-switch/default.nix
@@ -1,6 +1,6 @@
 { lib, fetchFromSourcehut, rustPlatform, nix-update-script }:
 
-let version = "0.4.0";
+let version = "0.5.0";
 in rustPlatform.buildRustPackage {
   pname = "sd-switch";
   inherit version;
@@ -9,10 +9,10 @@ in rustPlatform.buildRustPackage {
     owner = "~rycee";
     repo = "sd-switch";
     rev = version;
-    hash = "sha256-PPFYH34HAD/vC+9jpA1iPQRVNR6MX8ncSPC+7bl2oHY=";
+    hash = "sha256-TESS+CwwEugAz+grzndunAoKF9Or/Jl7tftL392fUaM=";
   };
 
-  cargoHash = "sha256-zUoa7nPNFvnYekbEZwtnJKZ6qd47Sb4LZGEkaKVQ9ZQ=";
+  cargoHash = "sha256-QEnleFwEIoKATupj0sSV/GUztQoozEsb3SEgnfFzAfw=";
 
   passthru = {
     updateScript = nix-update-script { };
diff --git a/pkgs/os-specific/linux/selinux-python/default.nix b/pkgs/os-specific/linux/selinux-python/default.nix
index c50f4ffccd0bb..c8c0a093b97e8 100644
--- a/pkgs/os-specific/linux/selinux-python/default.nix
+++ b/pkgs/os-specific/linux/selinux-python/default.nix
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "SELinux policy core utilities written in Python";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     homepage = "https://selinuxproject.org";
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/selinux-sandbox/default.nix b/pkgs/os-specific/linux/selinux-sandbox/default.nix
index 0d2843d216a46..7b033694ea264 100644
--- a/pkgs/os-specific/linux/selinux-sandbox/default.nix
+++ b/pkgs/os-specific/linux/selinux-sandbox/default.nix
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "SELinux sandbox utility";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     homepage = "https://selinuxproject.org";
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/semodule-utils/default.nix b/pkgs/os-specific/linux/semodule-utils/default.nix
index 013a9ecb90342..126f927007cd8 100644
--- a/pkgs/os-specific/linux/semodule-utils/default.nix
+++ b/pkgs/os-specific/linux/semodule-utils/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   meta = with lib; {
     description = "SELinux policy core utilities (packaging additions)";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     inherit (libsepol.meta) homepage platforms;
     maintainers = with maintainers; [ RossComputerGuy ];
   };
diff --git a/pkgs/os-specific/linux/setools/default.nix b/pkgs/os-specific/linux/setools/default.nix
index c815b8d86aa29..5a2f180a0ad96 100644
--- a/pkgs/os-specific/linux/setools/default.nix
+++ b/pkgs/os-specific/linux/setools/default.nix
@@ -36,7 +36,7 @@ buildPythonApplication rec {
   meta = {
     description = "SELinux Policy Analysis Tools";
     homepage = "https://github.com/SELinuxProject/setools";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/smemstat/default.nix b/pkgs/os-specific/linux/smemstat/default.nix
index 05ad1ddb03351..a6cdaf978c663 100644
--- a/pkgs/os-specific/linux/smemstat/default.nix
+++ b/pkgs/os-specific/linux/smemstat/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     description = "Memory usage monitoring tool";
     mainProgram = "smemstat";
     homepage = "https://github.com/ColinIanKing/smemstat";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ womfoo ];
   };
diff --git a/pkgs/os-specific/linux/sssd/default.nix b/pkgs/os-specific/linux/sssd/default.nix
index 4f27c7e83fb5d..b3395c7a4ceae 100644
--- a/pkgs/os-specific/linux/sssd/default.nix
+++ b/pkgs/os-specific/linux/sssd/default.nix
@@ -3,33 +3,25 @@
   python3, pam, popt, talloc, tdb, tevent, pkg-config, ldb, openldap,
   pcre2, libkrb5, cifs-utils, glib, keyutils, dbus, fakeroot, libxslt, libxml2,
   libuuid, systemd, nspr, check, cmocka, uid_wrapper, p11-kit,
-  nss_wrapper, ncurses, Po4a, http-parser, jansson, jose,
-  docbook_xsl, docbook_xml_dtd_44,
-  testers, nix-update-script, nixosTests, fetchpatch,
+  nss_wrapper, ncurses, Po4a, jansson, jose,
+  docbook_xsl, docbook_xml_dtd_45,
+  testers, nix-update-script, nixosTests,
   withSudo ? false }:
 
 let
-  docbookFiles = "${docbook_xsl}/share/xml/docbook-xsl/catalog.xml:${docbook_xml_dtd_44}/xml/dtd/docbook/catalog.xml";
+  docbookFiles = "${docbook_xsl}/share/xml/docbook-xsl/catalog.xml:${docbook_xml_dtd_45}/xml/dtd/docbook/catalog.xml";
 in
 stdenv.mkDerivation (finalAttrs: {
   pname = "sssd";
-  version = "2.9.4";
+  version = "2.9.5";
 
   src = fetchFromGitHub {
     owner = "SSSD";
     repo = "sssd";
     rev = "refs/tags/${finalAttrs.version}";
-    hash = "sha256-VJXZndbmC6mAVxzvv5Wjb4adrQkP16Rt4cgjl4qGDIc=";
+    hash = "sha256-wr6qFgM5XN3aizYVquj0xF+mVRgrkLWWhA3/gQOK8hQ=";
   };
 
-  patches = [
-    # Fix the build with Samba 4.20
-    (fetchpatch {
-      url = "https://github.com/SSSD/sssd/commit/1bf51929a48b84d62ac54f2a42f17e7fbffe1612.patch";
-      hash = "sha256-VLx04APEipp860iOJNIwTGywxZ7rIDdyh3te6m7Ymlo=";
-    })
-  ];
-
   postPatch = ''
     patchShebangs ./sbus_generate.sh.in
   '';
@@ -74,7 +66,7 @@ stdenv.mkDerivation (finalAttrs: {
                   talloc tdb tevent ldb pam openldap pcre2 libkrb5
                   cifs-utils glib keyutils dbus fakeroot libxslt libxml2
                   libuuid python3.pkgs.python-ldap systemd nspr check cmocka uid_wrapper
-                  nss_wrapper ncurses Po4a http-parser jansson jose ];
+                  nss_wrapper ncurses Po4a jansson jose ];
 
   makeFlags = [
     "SGML_CATALOG_FILES=${docbookFiles}"
diff --git a/pkgs/os-specific/linux/statifier/default.nix b/pkgs/os-specific/linux/statifier/default.nix
index 6aa11cad4f250..9c00cdab40164 100644
--- a/pkgs/os-specific/linux/statifier/default.nix
+++ b/pkgs/os-specific/linux/statifier/default.nix
@@ -20,6 +20,6 @@ multiStdenv.mkDerivation rec {
     description = "Tool for creating static Linux binaries";
     mainProgram = "statifier";
     platforms = platforms.linux;
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
   };
 }
diff --git a/pkgs/os-specific/linux/sydbox/default.nix b/pkgs/os-specific/linux/sydbox/default.nix
index bdaf77147f2ee..7bcb0c565974c 100644
--- a/pkgs/os-specific/linux/sydbox/default.nix
+++ b/pkgs/os-specific/linux/sydbox/default.nix
@@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     homepage = "https://sydbox.exherbo.org/";
     description = "seccomp-based application sandbox";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
     maintainers = with maintainers; [ mvs ];
   };
diff --git a/pkgs/os-specific/linux/sysdig/default.nix b/pkgs/os-specific/linux/sysdig/default.nix
index 59b48eeb7f715..ff149e771bcbf 100644
--- a/pkgs/os-specific/linux/sysdig/default.nix
+++ b/pkgs/os-specific/linux/sysdig/default.nix
@@ -135,7 +135,7 @@ in stdenv.mkDerivation {
   meta = {
     description =
       "A tracepoint-based system tracing tool for Linux (with clients for other OSes)";
-    license = with lib.licenses; [ asl20 gpl2 mit ];
+    license = with lib.licenses; [ asl20 gpl2Only mit ];
     maintainers = with lib.maintainers; [ raskin ];
     platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
     broken = kernel != null && ((lib.versionOlder kernel.version "4.14") || kernel.isHardened || kernel.isZen);
diff --git a/pkgs/os-specific/linux/sysfsutils/default.nix b/pkgs/os-specific/linux/sysfsutils/default.nix
index 113ba7939a65a..b0fd24c066b32 100644
--- a/pkgs/os-specific/linux/sysfsutils/default.nix
+++ b/pkgs/os-specific/linux/sysfsutils/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
         filesystem in Linux kernel versions 2.5+ that exposes a system's
         device tree.
       '';
-    license = with lib.licenses; [ gpl2 lgpl21 ];
+    license = with lib.licenses; [ gpl2Plus lgpl21 ];
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/sysklogd/default.nix b/pkgs/os-specific/linux/sysklogd/default.nix
index 09f76956d7fb2..cfccba6fb542c 100644
--- a/pkgs/os-specific/linux/sysklogd/default.nix
+++ b/pkgs/os-specific/linux/sysklogd/default.nix
@@ -36,6 +36,6 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "System logging daemon";
     platforms = platforms.linux;
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
   };
 }
diff --git a/pkgs/os-specific/linux/syslinux/default.nix b/pkgs/os-specific/linux/syslinux/default.nix
index 6023c6e82ff8e..c1424d01f878d 100644
--- a/pkgs/os-specific/linux/syslinux/default.nix
+++ b/pkgs/os-specific/linux/syslinux/default.nix
@@ -148,7 +148,7 @@ stdenv.mkDerivation {
     homepage = "https://www.syslinux.org/";
     description = "Lightweight bootloader";
     license = licenses.gpl2Plus;
-    maintainers = [ maintainers.samueldr ];
+    maintainers = [ ];
     platforms = [ "i686-linux" "x86_64-linux" ];
   };
 }
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index 0291de7242d0f..68209a4e2ccbc 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -407,6 +407,7 @@ stdenv.mkDerivation (finalAttrs: {
   '';
 
   outputs = [ "out" "dev" ] ++ (lib.optional (!buildLibsOnly) "man");
+  separateDebugInfo = true;
 
   hardeningDisable = [
     # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111523
@@ -500,6 +501,12 @@ stdenv.mkDerivation (finalAttrs: {
     (lib.mesonOption "default-hierarchy" "unified")
     (lib.mesonOption "kmod-path" "${kmod}/bin/kmod")
 
+    # Attempts to check /usr/sbin and that fails in macOS sandbox because
+    # permission is denied. If /usr/sbin is not a symlink, it defaults to true.
+    # We set it to false since stdenv moves sbin/* to bin and creates a symlink,
+    # that is, we do not have split bin.
+    (lib.mesonOption "split-bin" "false")
+
     # D-Bus
     (lib.mesonOption "dbuspolicydir" "${placeholder "out"}/share/dbus-1/system.d")
     (lib.mesonOption "dbussessionservicedir" "${placeholder "out"}/share/dbus-1/services")
@@ -814,6 +821,9 @@ stdenv.mkDerivation (finalAttrs: {
       substituteInPlace $i --replace /bin/false ${coreutils}/bin/false
     done
 
+    # For compatibility with dependents that use sbin instead of bin.
+    ln -s bin "$out/sbin"
+
     rm -rf $out/etc/rpm
   '' + lib.optionalString (!withKernelInstall) ''
     # "kernel-install" shouldn't be used on NixOS.
diff --git a/pkgs/os-specific/linux/tbs/default.nix b/pkgs/os-specific/linux/tbs/default.nix
index 4d4a1a96ce5fe..31baf57a4eba8 100644
--- a/pkgs/os-specific/linux/tbs/default.nix
+++ b/pkgs/os-specific/linux/tbs/default.nix
@@ -63,7 +63,7 @@ stdenv.mkDerivation {
   meta = with lib; {
     homepage = "https://www.tbsdtv.com/";
     description = "Linux driver for TBSDTV cards";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ ck3d ];
     priority = -1;
     broken = kernel.kernelOlder "4.14" || kernel.kernelAtLeast "6.9";
diff --git a/pkgs/os-specific/linux/tiptop/default.nix b/pkgs/os-specific/linux/tiptop/default.nix
index a26602b6b44cb..919df3bbedfcd 100644
--- a/pkgs/os-specific/linux/tiptop/default.nix
+++ b/pkgs/os-specific/linux/tiptop/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "Performance monitoring tool for Linux";
     homepage = "http://tiptop.gforge.inria.fr";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
     maintainers = [ ];
   };
diff --git a/pkgs/os-specific/linux/tmon/default.nix b/pkgs/os-specific/linux/tmon/default.nix
index a80724f19eb5a..c4222cfc3a245 100644
--- a/pkgs/os-specific/linux/tmon/default.nix
+++ b/pkgs/os-specific/linux/tmon/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
     description = "Monitoring and Testing Tool for Linux kernel thermal subsystem";
     mainProgram = "tmon";
     homepage = "https://www.kernel.org/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/tp_smapi/default.nix b/pkgs/os-specific/linux/tp_smapi/default.nix
index d9c5921d46551..b0f760e3b00ad 100644
--- a/pkgs/os-specific/linux/tp_smapi/default.nix
+++ b/pkgs/os-specific/linux/tp_smapi/default.nix
@@ -59,7 +59,7 @@ stdenv.mkDerivation rec {
   meta = {
     description = "IBM ThinkPad hardware functions driver";
     homepage = "https://github.com/linux-thinkpad/tp_smapi";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Plus;
     maintainers = [ ];
     # driver is only ment for linux thinkpads i think  bellow platforms should cover it.
     platforms = [ "x86_64-linux" "i686-linux" ];
diff --git a/pkgs/os-specific/linux/trace-cmd/kernelshark.nix b/pkgs/os-specific/linux/trace-cmd/kernelshark.nix
index 4251235469ccc..9f3d22c8a7077 100644
--- a/pkgs/os-specific/linux/trace-cmd/kernelshark.nix
+++ b/pkgs/os-specific/linux/trace-cmd/kernelshark.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, fetchzip, qtbase, qtscxml, cmake, asciidoc
-, docbook_xsl, json_c, mesa_glu, freeglut, trace-cmd, pkg-config
+, docbook_xsl, json_c, mesa_glu, libglut, trace-cmd, pkg-config
 , libtraceevent, libtracefs, freefont_ttf, wrapQtAppsHook, qtwayland
 }:
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation (finalAttrs: {
 
   nativeBuildInputs = [ pkg-config cmake wrapQtAppsHook ];
 
-  buildInputs = [ qtbase qtscxml qtwayland json_c mesa_glu freeglut libtraceevent libtracefs trace-cmd ];
+  buildInputs = [ qtbase qtscxml qtwayland json_c mesa_glu libglut libtraceevent libtracefs trace-cmd ];
 
   cmakeFlags = [
     "-D_INSTALL_PREFIX=${placeholder "out"}"
@@ -28,7 +28,7 @@ stdenv.mkDerivation (finalAttrs: {
   meta = with lib; {
     description = "GUI for trace-cmd which is an interface for the Linux kernel ftrace subsystem";
     homepage    = "https://kernelshark.org/";
-    license     = licenses.gpl2;
+    license     = licenses.gpl2Only;
     platforms   = platforms.linux;
     maintainers = with maintainers; [ basvandijk ];
   };
diff --git a/pkgs/os-specific/linux/tuna/default.nix b/pkgs/os-specific/linux/tuna/default.nix
index 3b527c8b534fe..634680dc318c2 100644
--- a/pkgs/os-specific/linux/tuna/default.nix
+++ b/pkgs/os-specific/linux/tuna/default.nix
@@ -57,6 +57,5 @@ buildPythonApplication rec {
     homepage = "https://git.kernel.org/pub/scm/utils/tuna/tuna.git";
     license = licenses.gpl2Plus;
     platforms = platforms.linux;
-    maintainers = with maintainers; [ elohmeier ];
   };
 }
diff --git a/pkgs/os-specific/linux/tunctl/default.nix b/pkgs/os-specific/linux/tunctl/default.nix
index 5e7fea75b6ab8..40d1aa572487a 100644
--- a/pkgs/os-specific/linux/tunctl/default.nix
+++ b/pkgs/os-specific/linux/tunctl/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     homepage = "https://tunctl.sourceforge.net/";
     description = "Utility to set up and maintain TUN/TAP network interfaces";
     mainProgram = "tunctl";
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/turbostat/default.nix b/pkgs/os-specific/linux/turbostat/default.nix
index 4c51bca386d24..92aafcfe173f6 100644
--- a/pkgs/os-specific/linux/turbostat/default.nix
+++ b/pkgs/os-specific/linux/turbostat/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
     description = "Report processor frequency and idle statistics";
     mainProgram = "turbostat";
     homepage = "https://www.kernel.org/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = [ "i686-linux" "x86_64-linux" ]; # x86-specific
   };
 }
diff --git a/pkgs/os-specific/linux/ulogd/default.nix b/pkgs/os-specific/linux/ulogd/default.nix
index 533db8f19c84a..291876cc92d24 100644
--- a/pkgs/os-specific/linux/ulogd/default.nix
+++ b/pkgs/os-specific/linux/ulogd/default.nix
@@ -72,7 +72,7 @@ stdenv.mkDerivation rec {
     '';
 
     homepage = "https://www.netfilter.org/projects/ulogd/index.html";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = platforms.linux;
     maintainers = with maintainers; [ p-h ];
   };
diff --git a/pkgs/os-specific/linux/undervolt/default.nix b/pkgs/os-specific/linux/undervolt/default.nix
index 4066139c6fc3f..045667c3e3a44 100644
--- a/pkgs/os-specific/linux/undervolt/default.nix
+++ b/pkgs/os-specific/linux/undervolt/default.nix
@@ -22,7 +22,7 @@ python3Packages.buildPythonApplication rec {
       voltage offset to one of 5 voltage planes, and override your systems temperature
       target (CPU will throttle when this temperature is reached).
     '';
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = [ "x86_64-linux" ];
   };
 }
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index b76579ecb4353..e393bf1ac08e6 100644
--- a/pkgs/os-specific/linux/util-linux/default.nix
+++ b/pkgs/os-specific/linux/util-linux/default.nix
@@ -1,9 +1,7 @@
-{ lib, stdenv, fetchurl, pkg-config
-, zlib, shadow
+{ lib, stdenv, fetchurl, pkg-config, zlib, shadow
 , capabilitiesSupport ? stdenv.isLinux
 , libcap_ng
 , libxcrypt
-, sqlite
 , ncursesSupport ? true
 , ncurses
 , pamSupport ? true
@@ -19,20 +17,14 @@
 , memstreamHook
 , gitUpdater
 }:
-let
-  # Temporarily avoid applying the patches on systems where already we have binaries
-  # (in particular x86_64-linux and aarch64-linux) as the package is a huge rebuild there.
-  avoidRebuild = with stdenv.hostPlatform; isLinux && is64bit && !isStatic;
-in
+
 stdenv.mkDerivation rec {
   pname = "util-linux" + lib.optionalString (!nlsSupport && !ncursesSupport && !systemdSupport) "-minimal";
-  version = if avoidRebuild then "2.40.1" else "2.39.4";
+  version = "2.39.4";
 
   src = fetchurl {
     url = "mirror://kernel/linux/utils/util-linux/v${lib.versions.majorMinor version}/util-linux-${version}.tar.xz";
-    hash = if avoidRebuild
-      then "sha256-WeZ2qlPMtEtsOfD/4BqPonSJHJG+8UdHUvrZJGHe8k8="
-      else "sha256-bE+HI9r9QcOdk+y/FlCfyIwzzVvTJ3iArlodl6AU/Q4=";
+    hash = "sha256-bE+HI9r9QcOdk+y/FlCfyIwzzVvTJ3iArlodl6AU/Q4=";
   };
 
   patches = [
@@ -48,7 +40,7 @@ stdenv.mkDerivation rec {
   separateDebugInfo = true;
 
   postPatch = ''
-    patchShebangs tests/run.sh tools/all_syscalls
+    patchShebangs tests/run.sh
 
     substituteInPlace sys-utils/eject.c \
       --replace "/bin/umount" "$bin/bin/umount"
@@ -67,7 +59,6 @@ stdenv.mkDerivation rec {
     "--enable-fs-paths-default=/run/wrappers/bin:/run/current-system/sw/bin:/sbin"
     "--disable-makeinstall-setuid" "--disable-makeinstall-chown"
     "--disable-su" # provided by shadow
-    "--with-tmpfilesdir=${placeholder "out"}/lib/tmpfiles.d"
     (lib.enableFeature writeSupport "write")
     (lib.enableFeature nlsSupport "nls")
     (lib.withFeature ncursesSupport "ncursesw")
@@ -89,7 +80,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config installShellFiles ]
     ++ lib.optionals translateManpages [ po4a ];
 
-  buildInputs = [ zlib libxcrypt sqlite ]
+  buildInputs = [ zlib libxcrypt ]
     ++ lib.optionals pamSupport [ pam ]
     ++ lib.optionals capabilitiesSupport [ libcap_ng ]
     ++ lib.optionals ncursesSupport [ ncurses ]
@@ -118,6 +109,9 @@ stdenv.mkDerivation rec {
     ln -svf "$swap/bin/"* $bin/bin/
     '' + ''
 
+    ln -svf "$bin/bin/hexdump" "$bin/bin/hd"
+    ln -svf "$man/share/man/man1/hexdump.1" "$man/share/man/man1/hd.1"
+
     installShellCompletion --bash bash-completion/*
   '';
 
diff --git a/pkgs/os-specific/linux/v4l2-relayd/default.nix b/pkgs/os-specific/linux/v4l2-relayd/default.nix
index 77d7034b863be..c1d48f3094095 100644
--- a/pkgs/os-specific/linux/v4l2-relayd/default.nix
+++ b/pkgs/os-specific/linux/v4l2-relayd/default.nix
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
     description = "Streaming relay for v4l2loopback using GStreamer";
     mainProgram = "v4l2-relayd";
     homepage = "https://git.launchpad.net/v4l2-relayd";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ betaboon ];
     platforms = [ "x86_64-linux" ];
   };
diff --git a/pkgs/os-specific/linux/v86d/default.nix b/pkgs/os-specific/linux/v86d/default.nix
index d59e8f52ff2b5..12e9b57d001cb 100644
--- a/pkgs/os-specific/linux/v86d/default.nix
+++ b/pkgs/os-specific/linux/v86d/default.nix
@@ -41,7 +41,7 @@ in stdenv.mkDerivation rec {
     description = "Daemon to run x86 code in an emulated environment";
     mainProgram = "v86d";
     homepage = "https://github.com/mjanusz/v86d";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     maintainers = with maintainers; [ codyopel ];
     platforms = [ "i686-linux" "x86_64-linux" ];
   };
diff --git a/pkgs/os-specific/linux/virtio_vmmci/default.nix b/pkgs/os-specific/linux/virtio_vmmci/default.nix
index a0db1483c5499..abb359fe06e4c 100644
--- a/pkgs/os-specific/linux/virtio_vmmci/default.nix
+++ b/pkgs/os-specific/linux/virtio_vmmci/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   meta = with lib; {
     description = "OpenBSD VMM Control Interface (vmmci) for Linux";
     homepage = "https://github.com/voutilad/virtio_vmmci";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ qbit ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/vmm_clock/default.nix b/pkgs/os-specific/linux/vmm_clock/default.nix
index 7ce99f40df1fd..686a20ada2438 100644
--- a/pkgs/os-specific/linux/vmm_clock/default.nix
+++ b/pkgs/os-specific/linux/vmm_clock/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     description =
       "Experimental implementation of a kvmclock-derived clocksource for Linux guests under OpenBSD's hypervisor";
     homepage = "https://github.com/voutilad/vmm_clock";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with maintainers; [ qbit ];
     platforms = [ "i686-linux" "x86_64-linux" ];
   };
diff --git a/pkgs/os-specific/linux/wireless-tools/default.nix b/pkgs/os-specific/linux/wireless-tools/default.nix
index e95506461a4bd..33318b16bb819 100644
--- a/pkgs/os-specific/linux/wireless-tools/default.nix
+++ b/pkgs/os-specific/linux/wireless-tools/default.nix
@@ -21,6 +21,6 @@ stdenv.mkDerivation rec {
     description = "Wireless tools for Linux";
     homepage = "https://hewlettpackard.github.io/wireless-tools/Tools.html";
     platforms = lib.platforms.linux;
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
   };
 }
diff --git a/pkgs/os-specific/linux/wiringpi/default.nix b/pkgs/os-specific/linux/wiringpi/default.nix
index bc80e2a33543b..a8eb74217a4f9 100644
--- a/pkgs/os-specific/linux/wiringpi/default.nix
+++ b/pkgs/os-specific/linux/wiringpi/default.nix
@@ -1,50 +1,54 @@
-{ lib
-, stdenv
-, symlinkJoin
-, fetchFromGitHub
-, libxcrypt
+{
+  lib,
+  stdenv,
+  symlinkJoin,
+  fetchFromGitHub,
+  libxcrypt,
 }:
 
 let
-  version = "2.61-1";
-  mkSubProject = { subprj # The only mandatory argument
-  , buildInputs ? []
-  , src ? fetchFromGitHub {
+  version = "3.6";
+  srcAll = fetchFromGitHub {
     owner = "WiringPi";
     repo = "WiringPi";
     rev = version;
-    sha256 = "sha256-VxAaPhaPXd9xYt663Ju6SLblqiSLizauhhuFqCqbO5M=";
-  }
-  }: stdenv.mkDerivation (finalAttrs: {
-    pname = "wiringpi-${subprj}";
-    inherit version src;
-    sourceRoot = "${src.name}/${subprj}";
-    inherit buildInputs;
-    # Remove (meant for other OSs) lines from Makefiles
-    preInstall = ''
-      sed -i "/chown root/d" Makefile
-      sed -i "/chmod/d" Makefile
-    '';
-    makeFlags = [
-      "DESTDIR=${placeholder "out"}"
-      "PREFIX=/."
-      # On NixOS we don't need to run ldconfig during build:
-      "LDCONFIG=echo"
-    ];
-  });
+    sha256 = "sha256-Hw81Ua9LTb/9l3Js1rx8TfCOF59MrrvH6AGsAsG1SoE=";
+  };
+  mkSubProject =
+    {
+      subprj, # The only mandatory argument
+      buildInputs ? [ ],
+      src ? srcAll,
+    }:
+    stdenv.mkDerivation (finalAttrs: {
+      pname = "wiringpi-${subprj}";
+      inherit version src;
+      sourceRoot = "${src.name}/${subprj}";
+      inherit buildInputs;
+      # Remove (meant for other OSs) lines from Makefiles
+      preInstall = ''
+        sed -i "/chown root/d" Makefile
+        sed -i "/chmod/d" Makefile
+      '';
+      makeFlags = [
+        "DESTDIR=${placeholder "out"}"
+        "PREFIX=/."
+        # On NixOS we don't need to run ldconfig during build:
+        "LDCONFIG=echo"
+      ];
+    });
   passthru = {
+    # Helps nix-update and probably nixpkgs-update find the src of this package
+    # automatically.
+    src = srcAll;
     inherit mkSubProject;
     wiringPi = mkSubProject {
       subprj = "wiringPi";
-      buildInputs = [
-        libxcrypt
-      ];
+      buildInputs = [ libxcrypt ];
     };
     devLib = mkSubProject {
       subprj = "devLib";
-      buildInputs = [
-        passthru.wiringPi
-      ];
+      buildInputs = [ passthru.wiringPi ];
     };
     wiringPiD = mkSubProject {
       subprj = "wiringPiD";
diff --git a/pkgs/os-specific/linux/x86_energy_perf_policy/default.nix b/pkgs/os-specific/linux/x86_energy_perf_policy/default.nix
index cbe2a8134e60f..309d9865bebc6 100644
--- a/pkgs/os-specific/linux/x86_energy_perf_policy/default.nix
+++ b/pkgs/os-specific/linux/x86_energy_perf_policy/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
     description = "Set the energy versus performance policy preference bias on recent X86 processors";
     mainProgram = "x86_energy_perf_policy";
     homepage = "https://www.kernel.org/";
-    license = licenses.gpl2;
+    license = licenses.gpl2Only;
     platforms = [ "i686-linux" "x86_64-linux" ]; # x86-specific
   };
 }
diff --git a/pkgs/os-specific/linux/x86info/default.nix b/pkgs/os-specific/linux/x86info/default.nix
index f330fbbe6c7a4..86830c851e55d 100644
--- a/pkgs/os-specific/linux/x86info/default.nix
+++ b/pkgs/os-specific/linux/x86info/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
       frequency, and identify the cache sizes and layout.
     '';
     platforms = [ "i686-linux" "x86_64-linux" ];
-    license = lib.licenses.gpl2;
+    license = lib.licenses.gpl2Only;
     homepage = "https://github.com/kernelslacker/x86info";
     maintainers = with lib.maintainers; [ jcumming ];
   };
diff --git a/pkgs/os-specific/linux/xone/default.nix b/pkgs/os-specific/linux/xone/default.nix
index fdc9990fb63d9..b61b242291882 100644
--- a/pkgs/os-specific/linux/xone/default.nix
+++ b/pkgs/os-specific/linux/xone/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation (finalAttrs: {
   meta = with lib; {
     description = "Linux kernel driver for Xbox One and Xbox Series X|S accessories";
     homepage = "https://github.com/medusalix/xone";
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     maintainers = with lib.maintainers; [ rhysmdnz ];
     platforms = platforms.linux;
   };
diff --git a/pkgs/os-specific/linux/xsensors/default.nix b/pkgs/os-specific/linux/xsensors/default.nix
index e3639fefffa4e..d229c22ee0c68 100644
--- a/pkgs/os-specific/linux/xsensors/default.nix
+++ b/pkgs/os-specific/linux/xsensors/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     ./replace-deprecated-gtk.patch
   ];
   meta = with lib; {
-    license = licenses.gpl2;
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = with maintainers; [ ];
   };
diff --git a/pkgs/os-specific/windows/mingw-w64/default.nix b/pkgs/os-specific/windows/mingw-w64/default.nix
index 706186c8e2f15..d464191328875 100644
--- a/pkgs/os-specific/windows/mingw-w64/default.nix
+++ b/pkgs/os-specific/windows/mingw-w64/default.nix
@@ -29,7 +29,7 @@ in stdenv.mkDerivation {
 
   nativeBuildInputs = [ autoreconfHook ];
   buildInputs = [ windows.mingw_w64_headers ];
-  hardeningDisable = [ "stackprotector" "fortify" ];
+  hardeningDisable = [ "stackprotector" "stackclashprotection" "fortify" ];
 
   meta = {
     platforms = lib.platforms.windows;