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/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/raycast/default.nix4
-rw-r--r--pkgs/os-specific/linux/bpftune/default.nix24
-rw-r--r--pkgs/os-specific/linux/ethq/default.nix4
-rw-r--r--pkgs/os-specific/linux/firmware/raspberrypi-wireless/default.nix10
-rw-r--r--pkgs/os-specific/linux/firmware/raspberrypi/default.nix9
-rw-r--r--pkgs/os-specific/linux/kernel/kernels-org.json32
-rw-r--r--pkgs/os-specific/linux/kernel/linux-libre.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rpi.nix35
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rt-5.15.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/manual-config.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/zen-kernels.nix8
-rw-r--r--pkgs/os-specific/linux/ksmbd-tools/default.nix1
-rw-r--r--pkgs/os-specific/linux/nsncd/default.nix8
-rw-r--r--pkgs/os-specific/linux/tuna/default.nix1
-rw-r--r--pkgs/os-specific/linux/wiringpi/default.nix72
96 files changed, 798 insertions, 351 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/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/raycast/default.nix b/pkgs/os-specific/darwin/raycast/default.nix
index 5df4990b59f2c..47af714267edc 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.0";
 
   src = fetchurl {
     name = "Raycast.dmg";
     url = "https://releases.raycast.com/releases/${finalAttrs.version}/download?build=universal";
-    hash = "sha256-9qvXUmCATwugK8lB1LeSnjfr5MNCjF9QTKR29LmbKes=";
+    hash = "sha256-rslrTwEl+Np8WdkEP1t79clmiBRhNvbN+q4dbU8TjgU=";
   };
 
   dontPatch = true;
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/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/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/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/kernel/kernels-org.json b/pkgs/os-specific/linux/kernel/kernels-org.json
index 9d0972661f9bb..1619002be01c3 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.93",
-        "hash": "sha256:1kqbfbw7ivhl6aqb8pl92fll4bhgyn8xkgv8vpx62gcjylpaycfz"
+        "version": "6.1.94",
+        "hash": "sha256:0sakp5k4q2xfd3la7j8s2rcbvndh6fdqgzz5ivyqf0df4anp3siq"
     },
     "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.219",
+        "hash": "sha256:0c6dhi6w8likvyyzw7wj2fqhz8nhv760kkic8bk66r1prhakzdwk"
     },
     "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.33",
-        "hash": "sha256:15yy80dwis74gmmamnnn8kayak3am15gg6llk4k74x9avhhbqgm1"
+        "version": "6.6.34",
+        "hash": "sha256:180v8q5376gl6zmjd54qcb1wpmz7cq299bdbhmz738rsb67yrq64"
     },
     "6.8": {
         "version": "6.8.12",
         "hash": "sha256:0fb0m0fv4521g63gq04d7lm6hy8169s1rykiav5bkd99s9b1kcqr"
     },
     "6.9": {
-        "version": "6.9.4",
-        "hash": "sha256:1hpcc1bkan1y03bigi8mxd86z0c0bjpklnp9piw1ml57s7h00a17"
+        "version": "6.9.5",
+        "hash": "sha256:1ccm5w2x3faln5d0jj954xf99x7hn74ihk5zv6di99h3a2mv87x5"
     }
 }
diff --git a/pkgs/os-specific/linux/kernel/linux-libre.nix b/pkgs/os-specific/linux/kernel/linux-libre.nix
index 9a03c39ec5691..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";
   }
 , ...
 }:
diff --git a/pkgs/os-specific/linux/kernel/linux-rpi.nix b/pkgs/os-specific/linux/kernel/linux-rpi.nix
index e0ce6549235d6..775a50980f6d4 100644
--- a/pkgs/os-specific/linux/kernel/linux-rpi.nix
+++ b/pkgs/os-specific/linux/kernel/linux-rpi.nix
@@ -2,8 +2,8 @@
 
 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}";
@@ -14,7 +14,7 @@ lib.overrideDerivation (buildLinux (args // {
     owner = "raspberrypi";
     repo = "linux";
     rev = tag;
-    hash = "sha256-4Rc57y70LmRFwDnOD4rHoHGmfxD9zYEAwYm9Wvyb3no=";
+    hash = "sha256-UWUTeCpEN7dlFSQjog6S3HyEWCCnaqiUqV5KxCjYink=";
   };
 
   defconfig = {
@@ -24,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.15.nix b/pkgs/os-specific/linux/kernel/linux-rt-5.15.nix
index 47634d116e9ac..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,7 +6,7 @@
 , ... } @ 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 // {
@@ -19,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/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix
index cb75f013b6241..3060ff9ef775a 100644
--- a/pkgs/os-specific/linux/kernel/manual-config.nix
+++ b/pkgs/os-specific/linux/kernel/manual-config.nix
@@ -172,12 +172,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
 
diff --git a/pkgs/os-specific/linux/kernel/zen-kernels.nix b/pkgs/os-specific/linux/kernel/zen-kernels.nix
index d0467dad0d6ec..270a608c84cd5 100644
--- a/pkgs/os-specific/linux/kernel/zen-kernels.nix
+++ b/pkgs/os-specific/linux/kernel/zen-kernels.nix
@@ -4,16 +4,16 @@ 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 // {
diff --git a/pkgs/os-specific/linux/ksmbd-tools/default.nix b/pkgs/os-specific/linux/ksmbd-tools/default.nix
index b81f581c07aaa..de5d15a0c75aa 100644
--- a/pkgs/os-specific/linux/ksmbd-tools/default.nix
+++ b/pkgs/os-specific/linux/ksmbd-tools/default.nix
@@ -37,6 +37,5 @@ stdenv.mkDerivation rec {
     homepage = "https://www.kernel.org/doc/html/latest/filesystems/cifs/ksmbd.html";
     license = licenses.gpl2;
     platforms = platforms.linux;
-    maintainers = with maintainers; [ elohmeier ];
   };
 }
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/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/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";