about summary refs log tree commit diff
path: root/pkgs/os-specific/bsd/netbsd/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/bsd/netbsd/pkgs')
-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/libbsd-overlay.pc2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix181
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/config.nix29
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/csu.nix50
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/dict.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix20
-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/headers.nix8
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix19
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/include.nix34
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix89
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix26
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libarch.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libc.nix116
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal.nix85
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix10
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix26
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix50
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libm.nix16
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libossaudio.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix10
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpthread/headers.nix5
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix42
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix14
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix44
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/librt.nix25
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix36
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix55
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/locale/package.nix2
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix21
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix70
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/make.nix64
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix24
-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.nix194
-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.nix7
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/package.nix4
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/setup-hook.sh11
-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/hook.nix17
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix21
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix56
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix46
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix46
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/tic.nix36
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix21
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix9
58 files changed, 1057 insertions, 659 deletions
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/libbsd-overlay.pc b/pkgs/os-specific/bsd/netbsd/pkgs/compat/libbsd-overlay.pc
index 3aadabe508822..086dd62303e96 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/compat/libbsd-overlay.pc
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/compat/libbsd-overlay.pc
@@ -1,7 +1,7 @@
 prefix=@out@
 exec_prefix=${prefix}
 libdir=${exec_prefix}/lib
-includedir=${prefix}/include
+includedir=@includedir@
 
 Name: nbcompat
 Description: NetBSD compatibility framework
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
index a1336ad52f6dc..0f7483ce55ad1 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
@@ -1,24 +1,29 @@
-{ lib, mkDerivation, stdenv
-, zlib
-, defaultMakeFlags
-, coreutils
-, cctools-port
-, include, libc, libutil
-, install
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, rsync
-, fetchNetBSD
-, _mainLibcExtraPaths
+{
+  lib,
+  mkDerivation,
+  stdenv,
+  zlib,
+  defaultMakeFlags,
+  coreutils,
+  cctools-port,
+  install,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  version,
 }:
 
-mkDerivation (let
-    version = "9.2";
+mkDerivation (
+  let
     commonDeps = [ zlib ];
-  in {
+  in
+  {
     path = "tools/compat";
-    sha256 = "1vsxg7136nlhc72vpa664vs22874xh7ila95nkmsd8crn3z3cyn0";
-    inherit version;
+
+    outputs = [
+      "out"
+      "dev"
+    ];
 
     setupHooks = [
       ../../../../../build-support/setup-hooks/role.bash
@@ -29,43 +34,51 @@ mkDerivation (let
       make include/.stamp configure nbtool_config.h.in defs.mk.in
     '';
 
-    configurePlatforms = [ "build" "host" ];
-    configureFlags = [
-      "--cache-file=config.cache"
-    ] ++ lib.optionals stdenv.hostPlatform.isMusl [
-      # We include this header in our musl package only for legacy
-      # compatibility, and compat works fine without it (and having it
-      # know about sys/cdefs.h breaks packages like glib when built
-      # statically).
-      "ac_cv_header_sys_cdefs_h=no"
+    configurePlatforms = [
+      "build"
+      "host"
     ];
+    configureFlags =
+      [ "--cache-file=config.cache" ]
+      ++ lib.optionals stdenv.hostPlatform.isMusl [
+        # We include this header in our musl package only for legacy
+        # compatibility, and compat works fine without it (and having it
+        # know about sys/cdefs.h breaks packages like glib when built
+        # statically).
+        "ac_cv_header_sys_cdefs_h=no"
+      ];
 
     nativeBuildInputs = commonDeps ++ [
-      bsdSetupHook netbsdSetupHook
+      bsdSetupHook
+      netbsdSetupHook
       makeMinimal
-      rsync
     ];
 
     buildInputs = commonDeps;
 
     # temporarily use gnuinstall for bootstrapping
     # bsdinstall will be built later
-    makeFlags = defaultMakeFlags ++ [
-      "INSTALL=${coreutils}/bin/install"
-      "DATADIR=$(out)/share"
-      # Can't sort object files yet
-      "LORDER=echo"
-      "TSORT=cat"
-      # Can't process man pages yet
-      "MKSHARE=no"
-    ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
-      # GNU objcopy produces broken .a libs which won't link into dependers.
-      # Makefiles only invoke `$OBJCOPY -x/-X`, so cctools strip works here.
-      "OBJCOPY=${cctools-port}/bin/strip"
-    ];
+    makeFlags =
+      defaultMakeFlags
+      ++ [
+        "INSTALL=${coreutils}/bin/install"
+        "DATADIR=$(dev)/share"
+        # Can't sort object files yet
+        "LORDER=echo"
+        "TSORT=cat"
+        # Can't process man pages yet
+        "MKSHARE=no"
+      ]
+      ++ lib.optionals stdenv.hostPlatform.isDarwin [
+        # GNU objcopy produces broken .a libs which won't link into dependers.
+        # Makefiles only invoke `$OBJCOPY -x/-X`, so cctools strip works here.
+        "OBJCOPY=${cctools-port}/bin/strip"
+      ];
     RENAME = "-D";
 
-    passthru.tests = { netbsd-install = install; };
+    passthru.tests = {
+      netbsd-install = install;
+    };
 
     patches = [
       ./compat-cxx-safe-header.patch
@@ -79,42 +92,50 @@ mkDerivation (let
       makeFlagsArray+=('INSTALL_SYMLINK=''${INSTALL} ''${SYMLINK} ''${RENAME}')
     '';
 
-    postInstall = ''
-      # why aren't these installed by netbsd?
-      install -D compat_defs.h $out/include/compat_defs.h
-      install -D $BSDSRCDIR/include/cdbw.h $out/include/cdbw.h
-      install -D $BSDSRCDIR/sys/sys/cdbr.h $out/include/cdbr.h
-      install -D $BSDSRCDIR/sys/sys/featuretest.h \
-                 $out/include/sys/featuretest.h
-      install -D $BSDSRCDIR/sys/sys/md5.h $out/include/md5.h
-      install -D $BSDSRCDIR/sys/sys/rmd160.h $out/include/rmd160.h
-      install -D $BSDSRCDIR/sys/sys/sha1.h $out/include/sha1.h
-      install -D $BSDSRCDIR/sys/sys/sha2.h $out/include/sha2.h
-      install -D $BSDSRCDIR/sys/sys/queue.h $out/include/sys/queue.h
-      install -D $BSDSRCDIR/include/vis.h $out/include/vis.h
-      install -D $BSDSRCDIR/include/db.h $out/include/db.h
-      install -D $BSDSRCDIR/include/netconfig.h $out/include/netconfig.h
-      install -D $BSDSRCDIR/include/utmpx.h $out/include/utmpx.h
-      install -D $BSDSRCDIR/include/tzfile.h $out/include/tzfile.h
-      install -D $BSDSRCDIR/sys/sys/tree.h $out/include/sys/tree.h
-      install -D $BSDSRCDIR/include/nl_types.h $out/include/nl_types.h
-      install -D $BSDSRCDIR/include/stringlist.h $out/include/stringlist.h
+    postInstall =
+      ''
+        # why aren't these installed by netbsd?
+        install -D compat_defs.h $dev/include/compat_defs.h
+        install -D $BSDSRCDIR/include/cdbw.h $dev/include/cdbw.h
+        install -D $BSDSRCDIR/sys/sys/cdbr.h $dev/include/cdbr.h
+        install -D $BSDSRCDIR/sys/sys/featuretest.h \
+                   $dev/include/sys/featuretest.h
+        install -D $BSDSRCDIR/sys/sys/md5.h $dev/include/md5.h
+        install -D $BSDSRCDIR/sys/sys/rmd160.h $dev/include/rmd160.h
+        install -D $BSDSRCDIR/sys/sys/sha1.h $dev/include/sha1.h
+        install -D $BSDSRCDIR/sys/sys/sha2.h $dev/include/sha2.h
+        install -D $BSDSRCDIR/sys/sys/queue.h $dev/include/sys/queue.h
+        install -D $BSDSRCDIR/include/vis.h $dev/include/vis.h
+        install -D $BSDSRCDIR/include/db.h $dev/include/db.h
+        install -D $BSDSRCDIR/include/netconfig.h $dev/include/netconfig.h
+        install -D $BSDSRCDIR/include/utmpx.h $dev/include/utmpx.h
+        install -D $BSDSRCDIR/include/tzfile.h $dev/include/tzfile.h
+        install -D $BSDSRCDIR/sys/sys/tree.h $dev/include/sys/tree.h
+        install -D $BSDSRCDIR/include/nl_types.h $dev/include/nl_types.h
+        install -D $BSDSRCDIR/include/stringlist.h $dev/include/stringlist.h
 
-      # Collapse includes slightly to fix dangling reference
-      install -D $BSDSRCDIR/common/include/rpc/types.h $out/include/rpc/types.h
-      sed -i '1s;^;#include "nbtool_config.h"\n;' $out/include/rpc/types.h
-   '' + lib.optionalString stdenv.isDarwin ''
-      mkdir -p $out/include/ssp
-      touch $out/include/ssp/ssp.h
-   '' + ''
-      mkdir -p $out/lib/pkgconfig
-      substitute ${./libbsd-overlay.pc} $out/lib/pkgconfig/libbsd-overlay.pc \
-        --subst-var-by out $out \
-        --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")
-    ] ++ libutil.extraPaths ++ _mainLibcExtraPaths;
-  })
+        # Collapse includes slightly to fix dangling reference
+        install -D $BSDSRCDIR/common/include/rpc/types.h $dev/include/rpc/types.h
+        sed -i '1s;^;#include "nbtool_config.h"\n;' $dev/include/rpc/types.h
+      ''
+      + lib.optionalString stdenv.isDarwin ''
+        mkdir -p $dev/include/ssp
+        touch $dev/include/ssp/ssp.h
+      ''
+      + ''
+        mkdir -p $dev/lib/pkgconfig
+        substitute ${./libbsd-overlay.pc} $dev/lib/pkgconfig/libbsd-overlay.pc \
+          --subst-var-by out "$out" \
+          --subst-var-by includedir "$dev/include" \
+          --subst-var-by version ${version}
+      '';
+    extraPaths = [
+      "common"
+      "include"
+      "lib/libc"
+      "lib/libutil"
+      "external/bsd/flex"
+      "sys/sys"
+    ];
+  }
+)
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/config.nix b/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
index 277d70129e6f7..94a014a189cf4 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
@@ -1,18 +1,27 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal, install, mandoc, byacc, flex, rsync
-, compatIfNeeded
-, cksum
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  byacc,
+  flex,
+  compatIfNeeded,
+  cksum,
 }:
 mkDerivation {
   path = "usr.bin/config";
-  version = "9.2";
-  sha256 = "1yz3n4hncdkk6kp595fh2q5lg150vpqg8iw2dccydkyw4y3hgsjj";
   env.NIX_CFLAGS_COMPILE = toString [ "-DMAKE_BOOTSTRAP" ];
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
-    makeMinimal install mandoc byacc flex rsync
+    bsdSetupHook
+    netbsdSetupHook
+    makeMinimal
+    install
+    mandoc
+    byacc
+    flex
   ];
   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 2d13ced6d5ed5..c6e0de8edd117 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
@@ -1,24 +1,46 @@
-{ lib, mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, flex
-, byacc, genassym, gencat, lorder, tsort, statHook, rsync
-, headers
-, sys
-, ld_elf_so
+{
+  lib,
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  flex,
+  byacc,
+  genassym,
+  gencat,
+  lorder,
+  tsort,
+  statHook,
+  headers,
+  sys-headers,
+  ld_elf_so,
 }:
 
 mkDerivation {
+  noLibc = true;
   path = "lib/csu";
-  version = "9.2";
-  sha256 = "0al5jfazvhlzn9hvmnrbchx4d0gm282hq5gp4xs2zmj9ycmf6d03";
   meta.platforms = lib.platforms.netbsd;
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff flex
-    byacc genassym gencat lorder tsort statHook rsync
+    install
+    mandoc
+    groff
+    flex
+    byacc
+    genassym
+    gencat
+    lorder
+    tsort
+    statHook
   ];
   buildInputs = [ headers ];
-  extraPaths = [ sys.src ld_elf_so.src ];
+  extraPaths = [
+    sys-headers.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 0393d36357f6e..3201a1c0e082a 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix
@@ -1,22 +1,22 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook, rsync
-, compatIfNeeded
-, fetchNetBSD
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  compatIfNeeded,
 }:
 
 mkDerivation {
   pname = "fts";
   path = "include/fts.h";
-  sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
-  version = "9.2";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook rsync
+    bsdSetupHook
+    netbsdSetupHook
   ];
   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/headers.nix b/pkgs/os-specific/bsd/netbsd/pkgs/headers.nix
index 646e5675130bb..40615b2722d5d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/headers.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/headers.nix
@@ -1,4 +1,10 @@
-{ lib, symlinkJoin, include, sys-headers, libpthread-headers }:
+{
+  lib,
+  symlinkJoin,
+  include,
+  sys-headers,
+  libpthread-headers,
+}:
 
 symlinkJoin {
   name = "netbsd-headers-9.2";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix b/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix
index 60b091ef0b718..9504ac22a74ed 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix
@@ -1,9 +1,20 @@
-{ lib, mkDerivation, libc }:
+{
+  lib,
+  stdenvLibcMinimal,
+  mkDerivation,
+  libcMinimal,
+}:
 
 mkDerivation {
   path = "lib/i18n_module";
-  version = "9.2";
-  sha256 = "0w6y5v3binm7gf2kn7y9jja8k18rhnyl55cvvfnfipjqdxvxd9jd";
+
+  libcMinimal = true;
+
+  # Hack around GCC's limits.h missing the include_next we want See
+  # https://gcc.gnu.org/legacy-ml/gcc/2003-10/msg01278.html
+  NIX_CFLAGS_COMPILE_BEFORE = "-isystem ${stdenvLibcMinimal.cc.libc.dev}/include";
+
+  extraPaths = [ libcMinimal.path ];
+
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ libc.src ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
index 1ecdec90ae095..1048016b81e2f 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
@@ -1,20 +1,30 @@
-{ lib, mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, rsync, nbperf, rpcgen
-, common
-, defaultMakeFlags
-, stdenv
+{
+  lib,
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  nbperf,
+  rpcgen,
+  defaultMakeFlags,
+  stdenv,
 }:
 
 mkDerivation {
+  noLibc = true;
   path = "include";
-  version = "9.2";
-  sha256 = "0nxnmj4c8s3hb9n3fpcmd0zl3l1nmhivqgi9a35sis943qvpgl9h";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff rsync nbperf rpcgen
+    install
+    mandoc
+    groff
+    nbperf
+    rpcgen
   ];
 
   # The makefiles define INCSDIR per subdirectory, so we have to set
@@ -32,7 +42,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 991517ac2d486..fa8bb690075f1 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
@@ -1,49 +1,58 @@
-{ mkDerivation
-, writeShellScript
-, mtree, make
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, mandoc, groff, rsync
-, compatIfNeeded, fts
+{
+  mkDerivation,
+  writeShellScript,
+  mtree,
+  make,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  mandoc,
+  groff,
+  compatIfNeeded,
+  fts,
 
 }:
 
 # HACK: to ensure parent directories exist. This emulates GNU
 # install’s -D option. No alternative seems to exist in BSD install.
 let
-  binstall = writeShellScript "binstall" ''
-    set -eu
-    for last in "$@"; do true; done
-    mkdir -p $(dirname $last)
-    @out@/bin/xinstall "$@"
-  '';
+  binstall = writeShellScript "binstall" (
+    builtins.readFile ../../../lib/install-wrapper.sh
+    + ''
+      @out@/bin/xinstall "''${args[@]}"
+    ''
+  );
 in
-  mkDerivation {
-    path = "usr.bin/xinstall";
-    version = "9.2";
-    sha256 = "1f6pbz3qv1qcrchdxif8p5lbmnwl8b9nq615hsd3cyl4avd5bfqj";
-    extraPaths = [ mtree.src make.src ];
-    nativeBuildInputs = [
-      bsdSetupHook netbsdSetupHook
-      makeMinimal
-      mandoc groff rsync
-    ];
-    skipIncludesPhase = true;
-    buildInputs = compatIfNeeded
-      # fts header is needed. glibc already has this header, but musl doesn't,
-      # so make sure pkgsMusl.netbsd.install still builds in case you want to
-      # remove it!
-      ++ [ fts ];
-    installPhase = ''
-      runHook preInstall
+mkDerivation {
+  path = "usr.bin/xinstall";
+  extraPaths = [
+    mtree.path
+    make.path
+  ];
+  nativeBuildInputs = [
+    bsdSetupHook
+    netbsdSetupHook
+    makeMinimal
+    mandoc
+    groff
+  ];
+  skipIncludesPhase = true;
+  buildInputs =
+    compatIfNeeded
+    # fts header is needed. glibc already has this header, but musl doesn't,
+    # so make sure pkgsMusl.netbsd.install still builds in case you want to
+    # remove it!
+    ++ [ fts ];
+  installPhase = ''
+    runHook preInstall
 
-      install -D install.1 $out/share/man/man1/install.1
-      install -D xinstall $out/bin/xinstall
-      install -D -m 0550 ${binstall} $out/bin/binstall
-      substituteInPlace $out/bin/binstall --subst-var out
-      ln -s $out/bin/binstall $out/bin/install
+    install -D install.1 $out/share/man/man1/install.1
+    install -D xinstall $out/bin/xinstall
+    install -D -m 0550 ${binstall} $out/bin/binstall
+    substituteInPlace $out/bin/binstall --subst-var out
+    ln -s $out/bin/binstall $out/bin/install
 
-      runHook postInstall
-    '';
-    setupHook = ./install-setup-hook.sh;
-  }
+    runHook postInstall
+  '';
+  setupHook = ./install-setup-hook.sh;
+}
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 1496ad6a0e884..900b87967927c 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
@@ -1,18 +1,24 @@
-{ lib
-, mkDerivation
-, libc
-, defaultMakeFlags
+{
+  lib,
+  mkDerivation,
+  libcMinimal,
+  defaultMakeFlags,
 }:
 
 mkDerivation {
-  path  = "libexec/ld.elf_so";
-  version = "9.2";
-  sha256 = "0ia9mqzdljly0vqfwflm5mzz55k7qsr4rw2bzhivky6k30vgirqa";
+  noLibc = true;
+  path = "libexec/ld.elf_so";
   meta.platforms = lib.platforms.netbsd;
-  LIBC_PIC = "${libc}/lib/libc_pic.a";
+  LIBC_PIC = "${libcMinimal}/lib/libc_pic.a";
   # Hack to prevent a symlink being installed here for compatibility.
   SHLINKINSTALLDIR = "/usr/libexec";
   USE_FORT = "yes";
-  makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/libexec" "CLIBOBJ=${libc}/lib" ];
-  extraPaths = [ libc.src ] ++ libc.extraPaths;
+  makeFlags = defaultMakeFlags ++ [
+    "BINDIR=$(out)/libexec"
+    "CLIBOBJ=${libcMinimal}/lib"
+  ];
+  extraPaths = [
+    libcMinimal.path
+    "sys"
+  ];
 }
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 ebc01a11668a6..665c9ce8ec8be 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
@@ -1,76 +1,52 @@
-{ lib
-, mkDerivation
-, defaultMakeFlags
-, _mainLibcExtraPaths
-, fetchNetBSD
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, flex
-, byacc, genassym, gencat, lorder, tsort, statHook, rsync, rpcgen
-, csu, headers
-, librt
+{
+  lib,
+  symlinkJoin,
+  libcMinimal,
+  libpthread,
+  libm,
+  libresolv,
+  librpcsvc,
+  i18n_module,
+  libutil,
+  librt,
+  libcrypt,
+  version,
 }:
 
-mkDerivation {
-  path = "lib/libc";
-  version = "9.2";
-  sha256 = "1y9c13igg0kai07sqvf9cm6yqmd8lhfd8hq3q7biilbgs1l99as3";
-  USE_FORT = "yes";
-  MKPROFILE = "no";
-  extraPaths = _mainLibcExtraPaths ++ [
-    (fetchNetBSD "external/bsd/jemalloc" "9.2" "0cq704swa0h2yxv4gc79z2lwxibk9k7pxh3q5qfs7axx3jx3n8kb")
-  ];
-  nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
-    makeMinimal
-    install mandoc groff flex
-    byacc genassym gencat lorder tsort statHook rsync rpcgen
-  ];
-  buildInputs = [ headers csu ];
-  env.NIX_CFLAGS_COMPILE = "-B${csu}/lib -fcommon";
-  meta.platforms = lib.platforms.netbsd;
-  SHLIBINSTALLDIR = "$(out)/lib";
-  MKPICINSTALL = "yes";
-  NLSDIR = "$(out)/share/nls";
-  makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/var/db"];
-  postInstall = ''
-    pushd ${headers}
-    find . -type d -exec mkdir -p $out/\{} \;
-    find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
-    popd
-
-    pushd ${csu}
-    find . -type d -exec mkdir -p $out/\{} \;
-    find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
-    popd
-
-    NIX_CFLAGS_COMPILE+=" -B$out/lib"
-    NIX_CFLAGS_COMPILE+=" -I$out/include"
-    NIX_LDFLAGS+=" -L$out/lib"
-
-    make -C $BSDSRCDIR/lib/libpthread $makeFlags
-    make -C $BSDSRCDIR/lib/libpthread $makeFlags install
-
-    make -C $BSDSRCDIR/lib/libm $makeFlags
-    make -C $BSDSRCDIR/lib/libm $makeFlags install
+symlinkJoin rec {
+  name = "${pname}-${version}";
+  pname = "libc-netbsd";
+  inherit version;
 
-    make -C $BSDSRCDIR/lib/libresolv $makeFlags
-    make -C $BSDSRCDIR/lib/libresolv $makeFlags install
-
-    make -C $BSDSRCDIR/lib/librpcsvc $makeFlags
-    make -C $BSDSRCDIR/lib/librpcsvc $makeFlags install
-
-    make -C $BSDSRCDIR/lib/i18n_module $makeFlags
-    make -C $BSDSRCDIR/lib/i18n_module $makeFlags install
-
-    make -C $BSDSRCDIR/lib/libutil $makeFlags
-    make -C $BSDSRCDIR/lib/libutil $makeFlags install
-
-    make -C $BSDSRCDIR/lib/librt $makeFlags
-    make -C $BSDSRCDIR/lib/librt $makeFlags install
+  outputs = [
+    "out"
+    "dev"
+    "man"
+  ];
 
-    make -C $BSDSRCDIR/lib/libcrypt $makeFlags
-    make -C $BSDSRCDIR/lib/libcrypt $makeFlags install
+  paths =
+    lib.concatMap
+      (p: [
+        (lib.getDev p)
+        (lib.getLib p)
+        (lib.getMan p)
+      ])
+      [
+        libcMinimal
+        libm
+        libpthread
+        libresolv
+        librpcsvc
+        i18n_module
+        libutil
+        librt
+        libcrypt
+      ];
+
+  postBuild = ''
+    rm -r "$out/nix-support"
+    fixupPhase
   '';
-  inherit (librt) postPatch;
+
+  meta.platforms = lib.platforms.netbsd;
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal.nix
new file mode 100644
index 0000000000000..bbab20d53d51e
--- /dev/null
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libcMinimal.nix
@@ -0,0 +1,85 @@
+{
+  lib,
+  mkDerivation,
+  defaultMakeFlags,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  flex,
+  byacc,
+  genassym,
+  gencat,
+  lorder,
+  tsort,
+  statHook,
+  rpcgen,
+  csu,
+  headers,
+}:
+
+mkDerivation {
+  noLibc = true;
+  path = "lib/libc";
+  pname = "libcMinimal-netbsd";
+  outputs = [
+    "out"
+    "dev"
+    "man"
+    "tags"
+  ];
+  USE_FORT = "yes";
+  MKPROFILE = "no";
+  extraPaths = [
+    "common"
+    "lib/i18n_module"
+    "libexec/ld.elf_so"
+    "sys"
+    "external/bsd/jemalloc"
+  ];
+  nativeBuildInputs = [
+    bsdSetupHook
+    netbsdSetupHook
+    makeMinimal
+    install
+    mandoc
+    groff
+    flex
+    byacc
+    genassym
+    gencat
+    lorder
+    tsort
+    statHook
+    rpcgen
+  ];
+  buildInputs = [
+    headers
+    csu
+  ];
+  env.NIX_CFLAGS_COMPILE = "-B${csu}/lib -fcommon";
+  meta.platforms = lib.platforms.netbsd;
+  SHLIBINSTALLDIR = "$(out)/lib";
+  MKPICINSTALL = "yes";
+  NLSDIR = "$(out)/share/nls";
+  makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/var/db" ];
+  postInstall = ''
+    pushd ${headers}
+    find include -type d -exec mkdir -p "$dev/{}" ';'
+    find include '(' -type f -o -type l ')' -exec cp -pr "{}" "$dev/{}" ';'
+    popd
+
+    pushd ${csu}
+    find lib -type d -exec mkdir -p "$out/{}" ';'
+    find lib '(' -type f -o -type l ')' -exec cp -pr "{}" "$out/{}" ';'
+    popd
+
+    moveToOutput var/db/libc.tags "$tags"
+  '';
+
+  postPatch = ''
+    sed -i 's,/usr\(/include/sys/syscall.h\),${headers}\1,g' lib/lib*/sys/Makefile.inc
+  '';
+}
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix
index c5f9deff589c4..f51dec0f68af2 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libcrypt.nix
@@ -2,8 +2,14 @@
 
 mkDerivation {
   path = "lib/libcrypt";
-  version = "9.2";
-  sha256 = "0siqan1wdqmmhchh2n8w6a8x1abbff8n4yb6jrqxap3hqn8ay54g";
+
+  libcMinimal = true;
+
+  outputs = [
+    "out"
+    "man"
+  ];
+
   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 2409879640a90..8d61bcfdf7d97 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix
@@ -1,19 +1,23 @@
-{ lib, mkDerivation, stdenv
-, libterminfo
-, compatIfNeeded
-, defaultMakeFlags
+{
+  lib,
+  mkDerivation,
+  stdenv,
+  libterminfo,
+  compatIfNeeded,
+  defaultMakeFlags,
 }:
 
 mkDerivation {
   path = "lib/libcurses";
-  version = "9.2";
-  sha256 = "0pd0dggl3w4bv5i5h0s1wrc8hr66n4hkv3zlklarwfdhc692fqal";
   buildInputs = [ libterminfo ];
-  env.NIX_CFLAGS_COMPILE = toString ([
-    "-D__scanflike(a,b)="
-    "-D__va_list=va_list"
-    "-D__warn_references(a,b)="
-  ] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)=");
+  env.NIX_CFLAGS_COMPILE = toString (
+    [
+      "-D__scanflike(a,b)="
+      "-D__va_list=va_list"
+      "-D__warn_references(a,b)="
+    ]
+    ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)="
+  );
   propagatedBuildInputs = compatIfNeeded;
   MKDOC = "no"; # missing vfontedpr
   makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${libterminfo}/lib" ];
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix
index eb734f34c3d49..cb9951cb8cf10 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix
@@ -1,26 +1,30 @@
-{ lib, mkDerivation
-, libterminfo, libcurses
-, compatIfNeeded
-, defaultMakeFlags
+{
+  lib,
+  mkDerivation,
+  libterminfo,
+  libcurses,
+  compatIfNeeded,
+  defaultMakeFlags,
 }:
 
 mkDerivation {
-    path = "lib/libedit";
-    version = "9.2";
-    sha256 = "1wqhngraxwqk4jgrf5f18jy195yrp7c06n1gf31pbplq79mg1bcj";
-    buildInputs = [ libterminfo libcurses ];
-    propagatedBuildInputs = compatIfNeeded;
-    SHLIBINSTALLDIR = "$(out)/lib";
-    makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${libterminfo}/lib" ];
-    postPatch = ''
-      sed -i '1i #undef bool_t' $COMPONENT_PATH/el.h
-      substituteInPlace $COMPONENT_PATH/config.h \
-        --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" ""
-      substituteInPlace $COMPONENT_PATH/readline/Makefile --replace /usr/include "$out/include"
-    '';
-    env.NIX_CFLAGS_COMPILE = toString [
-      "-D__noinline="
-      "-D__scanflike(a,b)="
-      "-D__va_list=va_list"
-    ];
-  }
+  path = "lib/libedit";
+  buildInputs = [
+    libterminfo
+    libcurses
+  ];
+  propagatedBuildInputs = compatIfNeeded;
+  SHLIBINSTALLDIR = "$(out)/lib";
+  makeFlags = defaultMakeFlags ++ [ "LIBDO.terminfo=${libterminfo}/lib" ];
+  postPatch = ''
+    sed -i '1i #undef bool_t' $COMPONENT_PATH/el.h
+    substituteInPlace $COMPONENT_PATH/config.h \
+      --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" ""
+    substituteInPlace $COMPONENT_PATH/readline/Makefile --replace /usr/include "$out/include"
+  '';
+  env.NIX_CFLAGS_COMPILE = toString [
+    "-D__noinline="
+    "-D__scanflike(a,b)="
+    "-D__va_list=va_list"
+  ];
+}
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
index 86990088adf28..f010c808c4843 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
@@ -1,10 +1,18 @@
-{ lib, mkDerivation, sys }:
+{ lib, mkDerivation }:
 
 mkDerivation {
   path = "lib/libm";
-  version = "9.2";
-  sha256 = "1apwfr26shdmbqqnmg7hxf7bkfxw44ynqnnnghrww9bnhqdnsy92";
+
+  libcMinimal = true;
+
+  outputs = [
+    "out"
+    "man"
+  ];
+
   SHLIBINSTALLDIR = "$(out)/lib";
+
+  extraPaths = [ "sys" ];
+
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ sys.src ];
 }
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 21ca0f62fd4e4..69d1ff5accca4 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix
@@ -1,11 +1,13 @@
-{ lib, mkDerivation, sys }:
+{
+  lib,
+  mkDerivation,
+  sys,
+}:
 
 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
deleted file mode 100644
index 485a12837bcb4..0000000000000
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  path = "lib/libpthread";
-  version = "9.2";
-  sha256 = "0mlmc31k509dwfmx5s2x010wxjc44mr6y0cbmk30cfipqh8c962h";
-}
-
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/headers.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/headers.nix
index 3896562501fc5..41a447e2b4083 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/headers.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/headers.nix
@@ -1,9 +1,10 @@
 { lib, mkDerivation }:
 
-mkDerivation (import ./base.nix // {
+mkDerivation {
+  path = "lib/libpthread";
   pname = "libpthread-headers";
   installPhase = "includesPhase";
   dontBuild = true;
   noCC = true;
   meta.platforms = lib.platforms.netbsd;
-})
+}
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix
index c2a0d407718e9..8e0ef5fd1b74e 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix
@@ -1,15 +1,35 @@
-{ lib, mkDerivation
-, headers
-, common, libc, librt, sys
+{
+  lib,
+  stdenvLibcMinimal,
+  mkDerivation,
+  headers,
+  libcMinimal,
+  librt,
 }:
 
-mkDerivation (import ./base.nix // {
-  pname = "libpthread";
-  installPhase = null;
-  noCC = false;
-  dontBuild = false;
-  buildInputs = [ headers ];
+mkDerivation {
+  path = "lib/libpthread";
+
+  libcMinimal = true;
+
+  outputs = [
+    "out"
+    "dev"
+    "man"
+  ];
+
   SHLIBINSTALLDIR = "$(out)/lib";
-  extraPaths = [ common libc.src librt.src sys.src ];
+
+  # Hack around GCC's limits.h missing the include_next we want See
+  # https://gcc.gnu.org/legacy-ml/gcc/2003-10/msg01278.html
+  NIX_CFLAGS_COMPILE_BEFORE = "-isystem ${stdenvLibcMinimal.cc.libc.dev}/include";
+
+  extraPaths = [
+    "common"
+    libcMinimal.path
+    librt.path
+    "sys"
+  ];
+
   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 2427592e4aa9a..63e95de850c09 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix
@@ -1,9 +1,15 @@
-{ lib, mkDerivation, libc }:
+{
+  lib,
+  mkDerivation,
+  libcMinimal,
+}:
 
 mkDerivation {
   path = "lib/libresolv";
-  version = "9.2";
-  sha256 = "1am74s74mf1ynwz3p4ncjkg63f78a1zjm983q166x4sgzps15626";
+
+  libcMinimal = true;
+
+  extraPaths = [ libcMinimal.path ];
+
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ libc.src ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix b/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
index 87524339e268f..60609ed134fb7 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
@@ -1,21 +1,39 @@
-{ lib
-, mkDerivation
-, defaultMakeFlags
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, tsort, lorder, rpcgen, statHook
+{
+  lib,
+  mkDerivation,
+  defaultMakeFlags,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  rpcgen,
+  statHook,
 }:
 
 mkDerivation {
   path = "lib/librpcsvc";
-  version = "9.2";
-  sha256 = "1q34pfiyjbrgrdqm46jwrsqms49ly6z3b0xh1wg331zga900vq5n";
-  makeFlags = defaultMakeFlags ++ [ "INCSDIR=$(out)/include/rpcsvc" ];
-  meta.platforms = lib.platforms.netbsd;
+
+  libcMinimal = true;
+
+  outputs = [
+    "out"
+    "dev"
+  ];
+
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install tsort lorder rpcgen statHook
+    install
+    tsort
+    lorder
+    rpcgen
+    statHook
   ];
-}
 
+  makeFlags = defaultMakeFlags ++ [ "INCSDIR=$(dev)/include/rpcsvc" ];
+
+  meta.platforms = lib.platforms.netbsd;
+}
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
index 2ffe0787004a5..c69062d9e87df 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
@@ -1,13 +1,22 @@
-{ lib, mkDerivation, libc, headers }:
+{
+  lib,
+  mkDerivation,
+  libcMinimal,
+}:
 
 mkDerivation {
   path = "lib/librt";
-  version = "9.2";
-  sha256 = "07f8mpjcqh5kig5z5sp97fg55mc4dz6aa1x5g01nv2pvbmqczxc6";
+
+  libcMinimal = true;
+
+  outputs = [
+    "out"
+    "man"
+  ];
+
+  extraPaths = [ libcMinimal.path ] ++ libcMinimal.extraPaths;
+
+  inherit (libcMinimal) postPatch;
+
   meta.platforms = lib.platforms.netbsd;
-  extraPaths = [ libc.src ] ++ 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 b9268cc7ba333..c02410a52ed2a 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix
@@ -1,17 +1,31 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal, install, tsort, lorder, mandoc, statHook, nbperf, tic, rsync
-, compatIfNeeded
-, fetchNetBSD
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  statHook,
+  nbperf,
+  tic,
+  compatIfNeeded,
 }:
 
 mkDerivation {
   path = "lib/libterminfo";
-  version = "9.2";
-  sha256 = "0pq05k3dj0dfsczv07frnnji92mazmy2qqngqbx2zgqc1x251414";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
-    makeMinimal install tsort lorder mandoc statHook nbperf tic rsync
+    bsdSetupHook
+    netbsdSetupHook
+    makeMinimal
+    install
+    tsort
+    lorder
+    mandoc
+    statHook
+    nbperf
+    tic
   ];
   buildInputs = compatIfNeeded;
   SHLIBINSTALLDIR = "$(out)/lib";
@@ -26,7 +40,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 4aaf8f0e7ab63..c217f6a7ce465 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix
@@ -1,21 +1,52 @@
-{ mkDerivation
-, common, libc, sys
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, byacc, install, tsort, lorder, mandoc, statHook, rsync
-, headers
+{
+  lib,
+  stdenvLibcMinimal,
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  byacc,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  statHook,
+  headers,
 }:
 
 mkDerivation {
   path = "lib/libutil";
-  version = "9.2";
-  sha256 = "02gm5a5zhh8qp5r5q5r7x8x6x50ir1i0ncgsnfwh1vnrz6mxbq7z";
-  extraPaths = [ common libc.src sys.src ];
+
+  libcMinimal = true;
+
+  outputs = [
+    "out"
+    "man"
+  ];
+
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    byacc install tsort lorder mandoc statHook rsync
+    byacc
+    install
+    tsort
+    lorder
+    mandoc
+    statHook
   ];
-  buildInputs = [ headers ];
+
   SHLIBINSTALLDIR = "$(out)/lib";
+
+  # Hack around GCC's limits.h missing the include_next we want See
+  # https://gcc.gnu.org/legacy-ml/gcc/2003-10/msg01278.html
+  NIX_CFLAGS_COMPILE_BEFORE = "-isystem ${stdenvLibcMinimal.cc.libc.dev}/include";
+
+  extraPaths = [
+    "common"
+    "lib/libc"
+    "sys"
+  ];
+
+  meta.platforms = lib.platforms.netbsd;
 }
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 d3109601382a0..b10b8caee2ff2 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix
@@ -1,16 +1,21 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, rsync
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
 }:
 
 mkDerivation {
   path = "usr.bin/lorder";
-  version = "9.2";
-  sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff rsync
+    install
+    mandoc
+    groff
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix b/pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix
new file mode 100644
index 0000000000000..e16027b535fca
--- /dev/null
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/make-rules.nix
@@ -0,0 +1,70 @@
+{
+  lib,
+  mkDerivation,
+  stdenv,
+  bsdSetupHook,
+  netbsdSetupHook,
+}:
+
+mkDerivation {
+  path = "share/mk";
+  noCC = true;
+
+  buildInputs = [ ];
+  nativeBuildInputs = [
+    bsdSetupHook
+    netbsdSetupHook
+  ];
+
+  dontBuild = true;
+
+  postPatch =
+    ''
+      substituteInPlace $BSDSRCDIR/share/mk/bsd.doc.mk \
+        --replace '-o ''${DOCOWN}' "" \
+        --replace '-g ''${DOCGRP}' ""
+      for mk in $BSDSRCDIR/share/mk/bsd.inc.mk $BSDSRCDIR/share/mk/bsd.kinc.mk; do
+        substituteInPlace $mk \
+          --replace '-o ''${BINOWN}' "" \
+          --replace '-g ''${BINGRP}' ""
+      done
+      substituteInPlace $BSDSRCDIR/share/mk/bsd.kmodule.mk \
+        --replace '-o ''${KMODULEOWN}' "" \
+        --replace '-g ''${KMODULEGRP}' ""
+      substituteInPlace $BSDSRCDIR/share/mk/bsd.lib.mk \
+        --replace '-o ''${LIBOWN}' "" \
+        --replace '-g ''${LIBGRP}' "" \
+        --replace '-o ''${DEBUGOWN}' "" \
+        --replace '-g ''${DEBUGGRP}' ""
+      substituteInPlace $BSDSRCDIR/share/mk/bsd.lua.mk \
+        --replace '-o ''${LIBOWN}' "" \
+        --replace '-g ''${LIBGRP}' ""
+      substituteInPlace $BSDSRCDIR/share/mk/bsd.man.mk \
+        --replace '-o ''${MANOWN}' "" \
+        --replace '-g ''${MANGRP}' ""
+      substituteInPlace $BSDSRCDIR/share/mk/bsd.nls.mk \
+        --replace '-o ''${NLSOWN}' "" \
+        --replace '-g ''${NLSGRP}' ""
+      substituteInPlace $BSDSRCDIR/share/mk/bsd.prog.mk \
+        --replace '-o ''${BINOWN}' "" \
+        --replace '-g ''${BINGRP}' "" \
+        --replace '-o ''${RUMPBINOWN}' "" \
+        --replace '-g ''${RUMPBINGRP}' "" \
+        --replace '-o ''${DEBUGOWN}' "" \
+        --replace '-g ''${DEBUGGRP}' ""
+
+       substituteInPlace $BSDSRCDIR/share/mk/bsd.lib.mk \
+         --replace '_INSTRANLIB=''${empty(PRESERVE):?-a "''${RANLIB} -t":}' '_INSTRANLIB='
+       substituteInPlace $BSDSRCDIR/share/mk/bsd.kinc.mk \
+         --replace /bin/rm rm
+    ''
+    + lib.optionalString stdenv.targetPlatform.isDarwin ''
+      substituteInPlace $BSDSRCDIR/share/mk/bsd.sys.mk \
+        --replace '-Wl,--fatal-warnings' "" \
+        --replace '-Wl,--warn-shared-textrel' ""
+    '';
+
+  installPhase = ''
+    cp -r . $out
+  '';
+}
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/make.nix b/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
index dcd80ef004678..9612ca7ff4893 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
@@ -1,60 +1,22 @@
-{ lib, mkDerivation, fetchNetBSD, stdenv }:
+{
+  lib,
+  mkDerivation,
+  stdenv,
+  make-rules,
+}:
 
 mkDerivation {
   path = "usr.bin/make";
-  sha256 = "0vi73yicbmbp522qzqvd979cx6zm5jakhy77xh73c1kygf8klccs";
-  version = "9.2";
 
- postPatch = ''
-   substituteInPlace $BSDSRCDIR/share/mk/bsd.doc.mk \
-     --replace '-o ''${DOCOWN}' "" \
-     --replace '-g ''${DOCGRP}' ""
-   for mk in $BSDSRCDIR/share/mk/bsd.inc.mk $BSDSRCDIR/share/mk/bsd.kinc.mk; do
-     substituteInPlace $mk \
-       --replace '-o ''${BINOWN}' "" \
-       --replace '-g ''${BINGRP}' ""
-   done
-   substituteInPlace $BSDSRCDIR/share/mk/bsd.kmodule.mk \
-     --replace '-o ''${KMODULEOWN}' "" \
-     --replace '-g ''${KMODULEGRP}' ""
-   substituteInPlace $BSDSRCDIR/share/mk/bsd.lib.mk \
-     --replace '-o ''${LIBOWN}' "" \
-     --replace '-g ''${LIBGRP}' "" \
-     --replace '-o ''${DEBUGOWN}' "" \
-     --replace '-g ''${DEBUGGRP}' ""
-   substituteInPlace $BSDSRCDIR/share/mk/bsd.lua.mk \
-     --replace '-o ''${LIBOWN}' "" \
-     --replace '-g ''${LIBGRP}' ""
-   substituteInPlace $BSDSRCDIR/share/mk/bsd.man.mk \
-     --replace '-o ''${MANOWN}' "" \
-     --replace '-g ''${MANGRP}' ""
-   substituteInPlace $BSDSRCDIR/share/mk/bsd.nls.mk \
-     --replace '-o ''${NLSOWN}' "" \
-     --replace '-g ''${NLSGRP}' ""
-   substituteInPlace $BSDSRCDIR/share/mk/bsd.prog.mk \
-     --replace '-o ''${BINOWN}' "" \
-     --replace '-g ''${BINGRP}' "" \
-     --replace '-o ''${RUMPBINOWN}' "" \
-     --replace '-g ''${RUMPBINGRP}' "" \
-     --replace '-o ''${DEBUGOWN}' "" \
-     --replace '-g ''${DEBUGGRP}' ""
+  postPatch =
+    make-rules.postPatch
+    + ''
+      # make needs this to pick up our sys make files
+      appendToVar NIX_CFLAGS_COMPILE "-D_PATH_DEFSYSPATH=\"$out/share/mk\""
+    '';
 
-    # make needs this to pick up our sys make files
-    export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
-
-    substituteInPlace $BSDSRCDIR/share/mk/bsd.lib.mk \
-      --replace '_INSTRANLIB=''${empty(PRESERVE):?-a "''${RANLIB} -t":}' '_INSTRANLIB='
-    substituteInPlace $BSDSRCDIR/share/mk/bsd.kinc.mk \
-      --replace /bin/rm rm
-  '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace $BSDSRCDIR/share/mk/bsd.sys.mk \
-      --replace '-Wl,--fatal-warnings' "" \
-      --replace '-Wl,--warn-shared-textrel' ""
-  '';
   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 18655b3bf863e..aab6e7f2b0dfe 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix
@@ -1,23 +1,27 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook, rsync
-, make
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  make,
+  make-rules,
 }:
 
 mkDerivation {
   path = "tools/make";
-  sha256 = "0fh0nrnk18m613m5blrliq2aydciv51qhc0ihsj4k63incwbk90n";
-  version = "9.2";
 
-  buildInputs = [];
+  buildInputs = [ ];
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook rsync
+    bsdSetupHook
+    netbsdSetupHook
   ];
 
   skipIncludesPhase = true;
 
   postPatch = ''
     patchShebangs $COMPONENT_PATH/configure
-    ${make.postPatch}
+
+    # make needs this to pick up our sys make files
+    appendToVar NIX_CFLAGS_COMPILE "-D_PATH_DEFSYSPATH=\"$out/share/mk\""
   '';
 
   buildPhase = ''
@@ -34,10 +38,10 @@ mkDerivation {
     install -D nbmake $out/bin/nbmake
     ln -s $out/bin/nbmake $out/bin/make
     mkdir -p $out/share
-    cp -r $BSDSRCDIR/share/mk $out/share/mk
+    cp -r ${make-rules} $out/share/mk
 
     runHook postInstall
   '';
 
-  extraPaths = [ make.src ] ++ make.extraPaths;
+  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 82e8889f6cf4d..8605bfbfcebe2 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
@@ -1,82 +1,134 @@
-{ lib
-, stdenvNoCC, stdenv
-, fetchNetBSD
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, tsort, lorder
-, mandoc, groff, statHook, rsync
-, compatIfNeeded
-, defaultMakeFlags
+{
+  lib,
+  stdenv,
+  stdenvNoCC,
+  crossLibcStdenv,
+  stdenvLibcMinimal,
+  runCommand,
+  rsync,
+  source,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  groff,
+  statHook,
+  compatIfNeeded,
+  defaultMakeFlags,
+  version,
 }:
 
-lib.makeOverridable (attrs: let
-  stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
-in stdenv'.mkDerivation ({
-  pname = "${attrs.pname or (baseNameOf attrs.path)}-netbsd";
-  inherit (attrs) version;
-  src = fetchNetBSD attrs.path attrs.version attrs.sha256;
+lib.makeOverridable (
+  attrs:
+  let
+    stdenv' =
+      if attrs.noCC or false then
+        stdenvNoCC
+      else if attrs.noLibc or false then
+        crossLibcStdenv
+      else if attrs.libcMinimal or false then
+        stdenvLibcMinimal
+      else
+        stdenv;
+  in
+  stdenv'.mkDerivation (
+    rec {
+      pname = "${attrs.pname or (baseNameOf attrs.path)}-netbsd";
+      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 = [ ];
+      extraPaths = [ ];
 
-  nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
-    makeMinimal
-    install tsort lorder mandoc groff statHook rsync
-  ];
-  buildInputs = compatIfNeeded;
+      nativeBuildInputs = [
+        bsdSetupHook
+        netbsdSetupHook
+        makeMinimal
+        install
+        tsort
+        lorder
+        mandoc
+        groff
+        statHook
+      ];
+      buildInputs = compatIfNeeded;
 
-  HOST_SH = stdenv'.shell;
+      HOST_SH = stdenv'.shell;
 
-  MACHINE_ARCH = {
-    i486 = "i386";
-    i586 = "i386";
-    i686 = "i386";
-  }.${stdenv'.hostPlatform.parsed.cpu.name}
-    or stdenv'.hostPlatform.parsed.cpu.name;
+      MACHINE_ARCH =
+        {
+          i486 = "i386";
+          i586 = "i386";
+          i686 = "i386";
+        }
+        .${stdenv'.hostPlatform.parsed.cpu.name} or stdenv'.hostPlatform.parsed.cpu.name;
 
-  MACHINE = {
-    x86_64 = "amd64";
-    aarch64 = "evbarm64";
-    i486 = "i386";
-    i586 = "i386";
-    i686 = "i386";
-  }.${stdenv'.hostPlatform.parsed.cpu.name}
-    or stdenv'.hostPlatform.parsed.cpu.name;
+      MACHINE =
+        {
+          x86_64 = "amd64";
+          aarch64 = "evbarm64";
+          i486 = "i386";
+          i586 = "i386";
+          i686 = "i386";
+        }
+        .${stdenv'.hostPlatform.parsed.cpu.name} or stdenv'.hostPlatform.parsed.cpu.name;
 
-  COMPONENT_PATH = attrs.path;
+      COMPONENT_PATH = attrs.path;
 
-  makeFlags = defaultMakeFlags;
+      makeFlags = defaultMakeFlags;
 
-  strictDeps = true;
+      strictDeps = true;
 
-  meta = with lib; {
-    maintainers = with maintainers; [ matthewbauer qyliss ];
-    platforms = platforms.unix;
-    license = licenses.bsd2;
-  };
-
-} // lib.optionalAttrs stdenv'.hasCC {
-  # TODO should CC wrapper set this?
-  CPP = "${stdenv'.cc.targetPrefix}cpp";
-} // lib.optionalAttrs stdenv'.isDarwin {
-  MKRELRO = "no";
-} // lib.optionalAttrs (stdenv'.cc.isClang or false) {
-  HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc);
-} // lib.optionalAttrs (stdenv'.cc.isGNU or false) {
-  HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc);
-} // lib.optionalAttrs (stdenv'.isx86_32) {
-  USE_SSP = "no";
-} // lib.optionalAttrs (attrs.headersOnly or false) {
-  installPhase = "includesPhase";
-  dontBuild = true;
-} // attrs // {
-  # Files that use NetBSD-specific macros need to have nbtool_config.h
-  # included ahead of them on non-NetBSD platforms.
-  postPatch = lib.optionalString (!stdenv'.hostPlatform.isNetBSD) ''
-    set +e
-    grep -Zlr "^__RCSID
-    ^__BEGIN_DECLS" $COMPONENT_PATH | xargs -0r grep -FLZ nbtool_config.h |
-        xargs -0tr sed -i '0,/^#/s//#include <nbtool_config.h>\n\0/'
-    set -e
-  '' + attrs.postPatch or "";
-}))
+      meta = with lib; {
+        maintainers = with maintainers; [
+          matthewbauer
+          qyliss
+        ];
+        platforms = platforms.unix;
+        license = licenses.bsd2;
+      };
+    }
+    // lib.optionalAttrs stdenv'.hasCC {
+      # TODO should CC wrapper set this?
+      CPP = "${stdenv'.cc.targetPrefix}cpp";
+    }
+    // lib.optionalAttrs stdenv'.isDarwin { MKRELRO = "no"; }
+    // lib.optionalAttrs (stdenv'.cc.isClang or false) {
+      HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc);
+    }
+    // lib.optionalAttrs (stdenv'.cc.isGNU or false) {
+      HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc);
+    }
+    // lib.optionalAttrs (stdenv'.isx86_32) { USE_SSP = "no"; }
+    // lib.optionalAttrs (attrs.headersOnly or false) {
+      installPhase = "includesPhase";
+      dontBuild = true;
+    }
+    // attrs
+    // {
+      # Files that use NetBSD-specific macros need to have nbtool_config.h
+      # included ahead of them on non-NetBSD platforms.
+      postPatch =
+        lib.optionalString (!stdenv'.hostPlatform.isNetBSD) ''
+          set +e
+          grep -Zlr "^__RCSID
+          ^__BEGIN_DECLS" $COMPONENT_PATH | xargs -0r grep -FLZ nbtool_config.h |
+              xargs -0tr sed -i '0,/^#/s//#include <nbtool_config.h>\n\0/'
+          set -e
+        ''
+        + attrs.postPatch or "";
+    }
+  )
+)
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 02ce7cf6ce5eb..3b52eae96c3b2 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix
@@ -1,8 +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/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/package.nix
index e80571f2bf9a2..31368523ee6fc 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/package.nix
@@ -1,5 +1,3 @@
 { makeSetupHook }:
 
-makeSetupHook {
-    name = "netbsd-setup-hook";
-  } ./setup-hook.sh
+makeSetupHook { name = "netbsd-setup-hook"; } ./setup-hook.sh
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 fa8b19e7d8ce4..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,15 +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/hook.nix b/pkgs/os-specific/bsd/netbsd/pkgs/stat/hook.nix
index 78186f55cd455..e38c53a3aac57 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/stat/hook.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/stat/hook.nix
@@ -1,4 +1,8 @@
-{ makeSetupHook, writeText, stat }:
+{
+  makeSetupHook,
+  writeText,
+  stat,
+}:
 
 # stat isn't in POSIX, and NetBSD stat supports a completely
 # different range of flags than GNU stat, so including it in PATH
@@ -6,9 +10,8 @@
 # NetBSD's build system and NetBSD stat without including it in
 # PATH.
 
-makeSetupHook {
-  name = "netbsd-stat-hook";
-} (writeText "netbsd-stat-hook-impl" ''
-  makeFlagsArray+=(TOOL_STAT=${stat}/bin/stat)
-'')
-
+makeSetupHook { name = "netbsd-stat-hook"; } (
+  writeText "netbsd-stat-hook-impl" ''
+    makeFlagsArray+=(TOOL_STAT=${stat}/bin/stat)
+  ''
+)
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix
index fa4d5cb3e21f6..f55bab160bc2c 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix
@@ -1,7 +1,11 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, rsync
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
 }:
 
 # Don't add this to nativeBuildInputs directly.
@@ -9,11 +13,12 @@
 
 mkDerivation {
   path = "usr.bin/stat";
-  version = "9.2";
-  sha256 = "18nqwlndfc34qbbgqx5nffil37jfq9aw663ippasfxd2hlyc106x";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff rsync
+    install
+    mandoc
+    groff
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix b/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
index ba458ef5c712f..116aa46e73503 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
@@ -1,14 +1,21 @@
-{ lib, mkDerivation
-, include
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal, install, tsort, lorder, statHook, rsync, uudecode, config, genassym
-, defaultMakeFlags
-, common
+{
+  lib,
+  mkDerivation,
+  include,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  statHook,
+  uudecode,
+  config,
+  genassym,
+  defaultMakeFlags,
 }:
 {
   path = "sys";
-  version = "9.2";
-  sha256 = "03s18q8d9giipf05bx199fajc2qwikji0djz7hw63d2lya6bfnpj";
 
   # Make the build ignore linker warnings
   prePatch = ''
@@ -29,23 +36,33 @@
     ''
       substituteInPlace sys/arch/i386/stand/efiboot/Makefile.efiboot \
         --replace "-nocombreloc" "-z nocombreloc"
-    '' +
-    # multiple header dirs, see above
-    include.postPatch;
+    ''
+    +
+      # multiple header dirs, see above
+      include.postPatch;
 
   CONFIG = "GENERIC";
 
   propagatedBuildInputs = [ include ];
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
-    makeMinimal install tsort lorder statHook rsync uudecode config genassym
+    bsdSetupHook
+    netbsdSetupHook
+    makeMinimal
+    install
+    tsort
+    lorder
+    statHook
+    uudecode
+    config
+    genassym
   ];
 
-  postConfigure = ''
-    pushd arch/$MACHINE/conf
-    config $CONFIG
-    popd
-  ''
+  postConfigure =
+    ''
+      pushd arch/$MACHINE/conf
+      config $CONFIG
+      popd
+    ''
     # multiple header dirs, see above
     + include.postConfigure;
 
@@ -67,6 +84,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 a3f20d772a3e7..d19d9d86cb382 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix
@@ -1,21 +1,45 @@
-{ lib, mkDerivation
-, include
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal, install, tsort, lorder, statHook, rsync, uudecode, config, genassym
-, defaultMakeFlags
-, common
+{
+  lib,
+  mkDerivation,
+  include,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  statHook,
+  uudecode,
+  config,
+  genassym,
+  defaultMakeFlags,
 }:
 let
   base = import ./base.nix {
     inherit
-      lib mkDerivation include bsdSetupHook netbsdSetupHook makeMinimal install
-      tsort lorder statHook rsync uudecode config genassym defaultMakeFlags
-      common;
+      lib
+      mkDerivation
+      include
+      bsdSetupHook
+      netbsdSetupHook
+      makeMinimal
+      install
+      tsort
+      lorder
+      statHook
+      uudecode
+      config
+      genassym
+      defaultMakeFlags
+      ;
   };
 in
-  mkDerivation (base // {
+mkDerivation (
+  base
+  // {
     pname = "sys-headers";
     installPhase = "includesPhase";
     dontBuild = true;
     noCC = true;
-  })
+  }
+)
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix
index 87031a50346ea..0bdd83126bcf7 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix
@@ -1,21 +1,45 @@
-{ lib, mkDerivation
-, include
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal, install, tsort, lorder, statHook, rsync, uudecode, config, genassym
-, defaultMakeFlags
-, common
+{
+  lib,
+  mkDerivation,
+  include,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  statHook,
+  uudecode,
+  config,
+  genassym,
+  defaultMakeFlags,
 }:
 let
   base = import ./base.nix {
     inherit
-      lib mkDerivation include bsdSetupHook netbsdSetupHook makeMinimal install
-      tsort lorder statHook rsync uudecode config genassym defaultMakeFlags
-      common;
+      lib
+      mkDerivation
+      include
+      bsdSetupHook
+      netbsdSetupHook
+      makeMinimal
+      install
+      tsort
+      lorder
+      statHook
+      uudecode
+      config
+      genassym
+      defaultMakeFlags
+      ;
   };
 in
-  mkDerivation (base // {
+mkDerivation (
+  base
+  // {
     pname = "sys";
     installPhase = null;
     noCC = false;
     dontBuild = false;
-  })
+  }
+)
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix b/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix
index 2a7e3644b6be9..42772d1d71285 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix
@@ -1,28 +1,34 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, nbperf, rsync
-, compatIfNeeded
-, defaultMakeFlags
-, libterminfo
-, fetchNetBSD
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  nbperf,
+  compatIfNeeded,
+  defaultMakeFlags,
+  libterminfo,
 }:
 
 mkDerivation {
   path = "tools/tic";
-  version = "9.2";
-  sha256 = "092y7db7k4kh2jq8qc55126r5qqvlb8lq8mhmy5ipbi36hwb4zrz";
   HOSTPROG = "tic";
   buildInputs = compatIfNeeded;
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff nbperf rsync
+    install
+    mandoc
+    groff
+    nbperf
   ];
   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 334eccc64c551..c844e48b4412a 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix
@@ -1,16 +1,21 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, rsync
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
 }:
 
 mkDerivation {
   path = "usr.bin/tsort";
-  version = "9.2";
-  sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff rsync
+    install
+    mandoc
+    groff
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix b/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
index dac9674f9d6f3..1e58df16ceeec 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
@@ -1,10 +1,11 @@
-{ lib, mkDerivation, stdenv }:
+{
+  lib,
+  mkDerivation,
+  stdenv,
+}:
 
 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";
 }
-