about summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2024-05-06 15:08:43 -0400
committerGitHub <noreply@github.com>2024-05-06 15:08:43 -0400
commitf5710818997d3d517521bd79348f92e546bb7bbe (patch)
tree3a61cd174003ca975f91f32e5e1f9ee2ef1da03f /pkgs/os-specific
parentc9335c6596a3d8426e40957171c1a96ed218a68c (diff)
parentd51697124627278b1b4d1bc27abbbbd2d5733482 (diff)
Merge pull request #309577 from obsidiansystems/bsd-reformat
bsd treewide: Run RFC formatter
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/bsd/freebsd/evdev-proto/default.nix11
-rw-r--r--pkgs/os-specific/bsd/freebsd/lib/default.nix18
-rw-r--r--pkgs/os-specific/bsd/freebsd/package-set.nix45
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix9
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix205
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/config.nix36
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/csu.nix24
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/ctfconvert.nix32
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/package.nix4
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/gencat.nix4
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix37
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/install.nix58
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix39
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libdwarf.nix30
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix23
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libnetbsd/package.nix29
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libsbuf.nix4
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/libutil.nix8
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/lorder.nix16
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/make.nix27
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/makeMinimal.nix17
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix151
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/mknod.nix4
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/rpcgen/package.nix7
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/stat.nix19
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/statHook.nix16
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/sys/package.nix155
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/tsort.nix21
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix314
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix172
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/config.nix27
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/csu.nix49
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix19
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/headers.nix8
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/include.nix32
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix81
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix16
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libc.nix59
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix24
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix52
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libm.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix1
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpthread/headers.nix17
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix39
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix28
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/librt.nix7
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix33
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix39
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix21
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/make.nix97
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix15
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix173
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix1
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/netbsdSetupHook/package.nix4
-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.nix55
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix50
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix50
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/tic.nix31
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix21
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix7
65 files changed, 1671 insertions, 982 deletions
diff --git a/pkgs/os-specific/bsd/freebsd/evdev-proto/default.nix b/pkgs/os-specific/bsd/freebsd/evdev-proto/default.nix
index d62c01f5eb887..6696d12912e68 100644
--- a/pkgs/os-specific/bsd/freebsd/evdev-proto/default.nix
+++ b/pkgs/os-specific/bsd/freebsd/evdev-proto/default.nix
@@ -1,4 +1,11 @@
-{ lib, stdenv, linuxHeaders, freebsd, runCommandCC, buildPackages }:
+{
+  lib,
+  stdenv,
+  linuxHeaders,
+  freebsd,
+  runCommandCC,
+  buildPackages,
+}:
 
 stdenv.mkDerivation {
   pname = "evdev-proto";
@@ -28,7 +35,7 @@ stdenv.mkDerivation {
   TOUCH = "touch";
   XARGS = "xargs";
 
-  ABI_FILE = runCommandCC "abifile" {} "$CC -shared -o $out";
+  ABI_FILE = runCommandCC "abifile" { } "$CC -shared -o $out";
   CLEAN_FETCH_ENV = true;
   INSTALL_AS_USER = true;
   NO_CHECKSUM = true;
diff --git a/pkgs/os-specific/bsd/freebsd/lib/default.nix b/pkgs/os-specific/bsd/freebsd/lib/default.nix
index 30fea7e17dce6..26119a8ba1968 100644
--- a/pkgs/os-specific/bsd/freebsd/lib/default.nix
+++ b/pkgs/os-specific/bsd/freebsd/lib/default.nix
@@ -3,14 +3,16 @@
 {
   inherit version;
 
-  mkBsdArch = stdenv':  {
-    x86_64 = "amd64";
-    aarch64 = "arm64";
-    i486 = "i386";
-    i586 = "i386";
-    i686 = "i386";
-  }.${stdenv'.hostPlatform.parsed.cpu.name}
-    or stdenv'.hostPlatform.parsed.cpu.name;
+  mkBsdArch =
+    stdenv':
+    {
+      x86_64 = "amd64";
+      aarch64 = "arm64";
+      i486 = "i386";
+      i586 = "i386";
+      i686 = "i386";
+    }
+    .${stdenv'.hostPlatform.parsed.cpu.name} or stdenv'.hostPlatform.parsed.cpu.name;
 
   install-wrapper = builtins.readFile ./install-wrapper.sh;
 }
diff --git a/pkgs/os-specific/bsd/freebsd/package-set.nix b/pkgs/os-specific/bsd/freebsd/package-set.nix
index 609b3f45b51e6..000377c6af91e 100644
--- a/pkgs/os-specific/bsd/freebsd/package-set.nix
+++ b/pkgs/os-specific/bsd/freebsd/package-set.nix
@@ -1,6 +1,12 @@
-{ stdenv, lib, stdenvNoCC
-, fetchzip
-, sourceData, versionData, buildFreebsd, patchesRoot
+{
+  stdenv,
+  lib,
+  stdenvNoCC,
+  fetchzip,
+  sourceData,
+  versionData,
+  buildFreebsd,
+  patchesRoot,
 }:
 
 self:
@@ -8,7 +14,8 @@ self:
 lib.packagesFromDirectoryRecursive {
   callPackage = self.callPackage;
   directory = ./pkgs;
-} // {
+}
+// {
   inherit sourceData patchesRoot versionData;
 
   # Keep the crawled portion of Nixpkgs finite.
@@ -21,11 +28,15 @@ lib.packagesFromDirectoryRecursive {
 
   compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isFreeBSD) self.compat;
   freebsd-lib = import ./lib {
-    version = lib.concatStringsSep "." (map toString (lib.filter (x: x != null) [
-      self.versionData.major
-      self.versionData.minor
-      self.versionData.patch or null
-    ]));
+    version = lib.concatStringsSep "." (
+      map toString (
+        lib.filter (x: x != null) [
+          self.versionData.major
+          self.versionData.minor
+          self.versionData.patch or null
+        ]
+      )
+    );
   };
 
   # The manual callPackages below should in principle be unnecessary, but are
@@ -51,21 +62,21 @@ lib.packagesFromDirectoryRecursive {
   };
 
   libc = self.callPackage ./pkgs/libc/package.nix {
-    inherit (buildFreebsd) makeMinimal install gencat rpcgen;
+    inherit (buildFreebsd)
+      makeMinimal
+      install
+      gencat
+      rpcgen
+      ;
     inherit (self) csu include;
   };
 
-  libnetbsd = self.callPackage ./pkgs/libnetbsd/package.nix {
-    inherit (buildFreebsd) makeMinimal;
-  };
+  libnetbsd = self.callPackage ./pkgs/libnetbsd/package.nix { inherit (buildFreebsd) makeMinimal; };
 
   mkDerivation = self.callPackage ./pkgs/mkDerivation.nix {
     inherit stdenv;
     inherit (buildFreebsd) makeMinimal install tsort;
   };
 
-  makeMinimal = self.callPackage ./pkgs/makeMinimal.nix {
-    inherit (self) make;
-  };
-
+  makeMinimal = self.callPackage ./pkgs/makeMinimal.nix { inherit (self) make; };
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix b/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix
index 71ecef1bcae47..966489d9aef36 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix
@@ -1,7 +1,10 @@
 { buildPackages, freebsd-lib }:
 
 # Wrap NetBSD's install
-buildPackages.writeShellScriptBin "boot-install" (freebsd-lib.install-wrapper + ''
+buildPackages.writeShellScriptBin "boot-install" (
+  freebsd-lib.install-wrapper
+  + ''
 
-  ${buildPackages.netbsd.install}/bin/xinstall "''${args[@]}"
-'')
+    ${buildPackages.netbsd.install}/bin/xinstall "''${args[@]}"
+  ''
+)
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix
index d31e3b05427bb..be3a7a9104745 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix
@@ -1,9 +1,16 @@
-{ lib, stdenv, mkDerivation, patchesRoot
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, boot-install
-, which
-, freebsd-lib
-, expat, zlib,
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  patchesRoot,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  boot-install,
+  which,
+  freebsd-lib,
+  expat,
+  zlib,
 }:
 
 let
@@ -13,90 +20,95 @@ in
 mkDerivation rec {
   pname = "compat";
   path = "tools/build";
-  extraPaths = [
-    "lib/libc/db"
-    "lib/libc/stdlib" # getopt
-    "lib/libc/gen" # getcap
-    "lib/libc/locale" # rpmatch
-  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
-    "lib/libc/string" # strlcpy
-    "lib/libutil"
-  ] ++ [
-    "contrib/libc-pwcache"
-    "contrib/libc-vis"
-    "sys/libkern"
-    "sys/kern/subr_capability.c"
-
-    # Take only individual headers, or else we will clobber native libc, etc.
-
-    "sys/rpc/types.h"
-
-    # Listed in Makekfile as INC
-    "include/mpool.h"
-    "include/ndbm.h"
-    "include/err.h"
-    "include/stringlist.h"
-    "include/a.out.h"
-    "include/nlist.h"
-    "include/db.h"
-    "include/getopt.h"
-    "include/nl_types.h"
-    "include/elf.h"
-    "sys/sys/ctf.h"
-
-    # Listed in Makekfile as SYSINC
-
-    "sys/sys/capsicum.h"
-    "sys/sys/caprights.h"
-    "sys/sys/imgact_aout.h"
-    "sys/sys/nlist_aout.h"
-    "sys/sys/nv.h"
-    "sys/sys/dnv.h"
-    "sys/sys/cnv.h"
-
-    "sys/sys/elf32.h"
-    "sys/sys/elf64.h"
-    "sys/sys/elf_common.h"
-    "sys/sys/elf_generic.h"
-    "sys/${mkBsdArch stdenv}/include"
-  ] ++ lib.optionals stdenv.hostPlatform.isx86 [
-    "sys/x86/include"
-  ] ++ [
-
-    "sys/sys/queue.h"
-    "sys/sys/md5.h"
-    "sys/sys/sbuf.h"
-    "sys/sys/tree.h"
-    "sys/sys/font.h"
-    "sys/sys/consio.h"
-    "sys/sys/fnv_hash.h"
-
-    "sys/crypto/chacha20/_chacha.h"
-    "sys/crypto/chacha20/chacha.h"
-    # included too, despite ".c"
-    "sys/crypto/chacha20/chacha.c"
-
-    "sys/fs"
-    "sys/ufs"
-    "sys/sys/disk"
-
-    "lib/libcapsicum"
-    "lib/libcasper"
-  ];
+  extraPaths =
+    [
+      "lib/libc/db"
+      "lib/libc/stdlib" # getopt
+      "lib/libc/gen" # getcap
+      "lib/libc/locale" # rpmatch
+    ]
+    ++ lib.optionals stdenv.hostPlatform.isLinux [
+      "lib/libc/string" # strlcpy
+      "lib/libutil"
+    ]
+    ++ [
+      "contrib/libc-pwcache"
+      "contrib/libc-vis"
+      "sys/libkern"
+      "sys/kern/subr_capability.c"
+
+      # Take only individual headers, or else we will clobber native libc, etc.
+
+      "sys/rpc/types.h"
+
+      # Listed in Makekfile as INC
+      "include/mpool.h"
+      "include/ndbm.h"
+      "include/err.h"
+      "include/stringlist.h"
+      "include/a.out.h"
+      "include/nlist.h"
+      "include/db.h"
+      "include/getopt.h"
+      "include/nl_types.h"
+      "include/elf.h"
+      "sys/sys/ctf.h"
+
+      # Listed in Makekfile as SYSINC
+
+      "sys/sys/capsicum.h"
+      "sys/sys/caprights.h"
+      "sys/sys/imgact_aout.h"
+      "sys/sys/nlist_aout.h"
+      "sys/sys/nv.h"
+      "sys/sys/dnv.h"
+      "sys/sys/cnv.h"
+
+      "sys/sys/elf32.h"
+      "sys/sys/elf64.h"
+      "sys/sys/elf_common.h"
+      "sys/sys/elf_generic.h"
+      "sys/${mkBsdArch stdenv}/include"
+    ]
+    ++ lib.optionals stdenv.hostPlatform.isx86 [ "sys/x86/include" ]
+    ++ [
+
+      "sys/sys/queue.h"
+      "sys/sys/md5.h"
+      "sys/sys/sbuf.h"
+      "sys/sys/tree.h"
+      "sys/sys/font.h"
+      "sys/sys/consio.h"
+      "sys/sys/fnv_hash.h"
+
+      "sys/crypto/chacha20/_chacha.h"
+      "sys/crypto/chacha20/chacha.h"
+      # included too, despite ".c"
+      "sys/crypto/chacha20/chacha.c"
+
+      "sys/fs"
+      "sys/ufs"
+      "sys/sys/disk"
+
+      "lib/libcapsicum"
+      "lib/libcasper"
+    ];
 
   patches = [
     /${patchesRoot}/compat-install-dirs.patch
     /${patchesRoot}/compat-fix-typedefs-locations.patch
   ];
 
-  preBuild = ''
-    NIX_CFLAGS_COMPILE+=' -I../../include -I../../sys'
+  preBuild =
+    ''
+      NIX_CFLAGS_COMPILE+=' -I../../include -I../../sys'
 
-    cp ../../sys/${mkBsdArch stdenv}/include/elf.h ../../sys/sys
-    cp ../../sys/${mkBsdArch stdenv}/include/elf.h ../../sys/sys/${mkBsdArch stdenv}
-  '' + lib.optionalString stdenv.hostPlatform.isx86 ''
-    cp ../../sys/x86/include/elf.h ../../sys/x86
-  '';
+      cp ../../sys/${mkBsdArch stdenv}/include/elf.h ../../sys/sys
+      cp ../../sys/${mkBsdArch stdenv}/include/elf.h ../../sys/sys/${mkBsdArch stdenv}
+    ''
+    + lib.optionalString stdenv.hostPlatform.isx86 ''
+      cp ../../sys/x86/include/elf.h ../../sys/x86
+    '';
 
   setupHooks = [
     ../../../../../build-support/setup-hooks/role.bash
@@ -109,13 +121,17 @@ mkDerivation rec {
   '';
 
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
+    bsdSetupHook
+    freebsdSetupHook
     makeMinimal
     boot-install
 
     which
   ];
-  buildInputs = [ expat zlib ];
+  buildInputs = [
+    expat
+    zlib
+  ];
 
   makeFlags = [
     "STRIP=-s" # flag to install, not command
@@ -124,12 +140,15 @@ mkDerivation rec {
     "INSTALL=boot-install"
   ];
 
-  preIncludes = ''
-    mkdir -p $out/{0,1}-include
-    cp --no-preserve=mode -r cross-build/include/common/* $out/0-include
-  '' + lib.optionalString stdenv.hostPlatform.isLinux ''
-    cp --no-preserve=mode -r cross-build/include/linux/* $out/1-include
-  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
-    cp --no-preserve=mode -r cross-build/include/darwin/* $out/1-include
-  '';
+  preIncludes =
+    ''
+      mkdir -p $out/{0,1}-include
+      cp --no-preserve=mode -r cross-build/include/common/* $out/0-include
+    ''
+    + lib.optionalString stdenv.hostPlatform.isLinux ''
+      cp --no-preserve=mode -r cross-build/include/linux/* $out/1-include
+    ''
+    + lib.optionalString stdenv.hostPlatform.isDarwin ''
+      cp --no-preserve=mode -r cross-build/include/darwin/* $out/1-include
+    '';
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/config.nix b/pkgs/os-specific/bsd/freebsd/pkgs/config.nix
index 641cfc46b4e9b..f7ba273ed5583 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/config.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/config.nix
@@ -1,17 +1,35 @@
-{ mkDerivation
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, install, mandoc, groff
-, flex, byacc, file2c
-, compatIfNeeded, libnv, libsbuf
+{
+  mkDerivation,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  flex,
+  byacc,
+  file2c,
+  compatIfNeeded,
+  libnv,
+  libsbuf,
 }:
 
 mkDerivation {
   path = "usr.sbin/config";
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal install mandoc groff
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    install
+    mandoc
+    groff
 
-    flex byacc file2c
+    flex
+    byacc
+    file2c
+  ];
+  buildInputs = compatIfNeeded ++ [
+    libnv
+    libsbuf
   ];
-  buildInputs = compatIfNeeded ++ [ libnv libsbuf ];
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix b/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix
index 0b17cb1c8481d..fd62338d7f9f0 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix
@@ -1,9 +1,14 @@
-{ lib, mkDerivation
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal
-, install
-, flex, byacc, gencat
-, include
+{
+  lib,
+  mkDerivation,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  flex,
+  byacc,
+  gencat,
+  include,
 }:
 
 mkDerivation {
@@ -13,11 +18,14 @@ mkDerivation {
     "lib/libc/include/libc_private.h"
   ];
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
+    bsdSetupHook
+    freebsdSetupHook
     makeMinimal
     install
 
-    flex byacc gencat
+    flex
+    byacc
+    gencat
   ];
   buildInputs = [ include ];
   MK_TESTS = "no";
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/ctfconvert.nix b/pkgs/os-specific/bsd/freebsd/pkgs/ctfconvert.nix
index 0aebc9b3d0b93..a85836e58b8de 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/ctfconvert.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/ctfconvert.nix
@@ -1,7 +1,18 @@
-{ lib, stdenv, mkDerivation
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, install, mandoc, groff
-, compatIfNeeded, libelf, libdwarf, zlib, libspl
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  compatIfNeeded,
+  libelf,
+  libdwarf,
+  zlib,
+  libspl,
 }:
 
 mkDerivation {
@@ -16,13 +27,20 @@ mkDerivation {
   OPENSOLARIS_USR_DISTDIR = "$(SRCTOP)/cddl/contrib/opensolaris";
   OPENSOLARIS_SYS_DISTDIR = "$(SRCTOP)/sys/cddl/contrib/opensolaris";
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal install mandoc groff
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    install
+    mandoc
+    groff
 
     # flex byacc file2c
   ];
   buildInputs = compatIfNeeded ++ [
-    libelf libdwarf zlib libspl
+    libelf
+    libdwarf
+    zlib
+    libspl
   ];
   meta.license = lib.licenses.cddl;
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/package.nix
index 430c4c5c43ac1..ef4a14ccf4aa9 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/freebsdSetupHook/package.nix
@@ -1,5 +1,3 @@
 { makeSetupHook }:
 
-makeSetupHook {
-  name = "freebsd-setup-hook";
-} ./setup-hook.sh
+makeSetupHook { name = "freebsd-setup-hook"; } ./setup-hook.sh
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/gencat.nix b/pkgs/os-specific/bsd/freebsd/pkgs/gencat.nix
index e9ae9f27cc05b..ea701b6404ecc 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/gencat.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/gencat.nix
@@ -1,5 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "usr.bin/gencat";
-}
+mkDerivation { path = "usr.bin/gencat"; }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
index 5c6f3ac4a16b6..fd17dcbb99e0b 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
@@ -1,9 +1,16 @@
-{ lib, mkDerivation, patchesRoot
-, buildPackages
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal
-, install
-, mandoc, groff, rsync /*, nbperf*/, rpcgen
+{
+  lib,
+  mkDerivation,
+  patchesRoot,
+  buildPackages,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  rsync, # , nbperf
+  rpcgen,
 }:
 
 mkDerivation {
@@ -15,19 +22,21 @@ mkDerivation {
     "sys"
   ];
 
-  nativeBuildInputs =  [
-    bsdSetupHook freebsdSetupHook
+  nativeBuildInputs = [
+    bsdSetupHook
+    freebsdSetupHook
     makeMinimal
     install
-    mandoc groff rsync /*nbperf*/ rpcgen
+    mandoc
+    groff
+    rsync # nbperf
+    rpcgen
 
     # HACK use NetBSD's for now
     buildPackages.netbsd.mtree
   ];
 
-  patches = [
-    /${patchesRoot}/no-perms-BSD.include.dist.patch
-  ];
+  patches = [ /${patchesRoot}/no-perms-BSD.include.dist.patch ];
 
   # The makefiles define INCSDIR per subdirectory, so we have to set
   # something else on the command line so those definitions aren't
@@ -39,9 +48,7 @@ mkDerivation {
         {} \;
   '';
 
-  makeFlags = [
-    "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp"
-  ];
+  makeFlags = [ "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp" ];
 
   # multiple header dirs, see above
   postConfigure = ''
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/install.nix b/pkgs/os-specific/bsd/freebsd/pkgs/install.nix
index 3db6cd3633d49..0f70087618df0 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/install.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/install.nix
@@ -1,31 +1,49 @@
-{ lib, stdenv, mkDerivation, writeShellScript
-, freebsd-lib
-, mtree
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, mandoc, groff
-, boot-install, install
-, compatIfNeeded, libmd, libnetbsd
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  writeShellScript,
+  freebsd-lib,
+  mtree,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  mandoc,
+  groff,
+  boot-install,
+  install,
+  compatIfNeeded,
+  libmd,
+  libnetbsd,
 }:
 
 # 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" (freebsd-lib.install-wrapper + ''
+  binstall = writeShellScript "binstall" (
+    freebsd-lib.install-wrapper
+    + ''
 
-    @out@/bin/xinstall "''${args[@]}"
-  '');
-in mkDerivation {
+      @out@/bin/xinstall "''${args[@]}"
+    ''
+  );
+in
+mkDerivation {
   path = "usr.bin/xinstall";
   extraPaths = [ mtree.path ];
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal mandoc groff
-    (if stdenv.hostPlatform == stdenv.buildPlatform
-     then boot-install
-     else install)
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    mandoc
+    groff
+    (if stdenv.hostPlatform == stdenv.buildPlatform then boot-install else install)
   ];
   skipIncludesPhase = true;
-  buildInputs = compatIfNeeded ++ [ libmd libnetbsd ];
+  buildInputs = compatIfNeeded ++ [
+    libmd
+    libnetbsd
+  ];
   makeFlags = [
     "STRIP=-s" # flag to install, not command
     "MK_WERROR=no"
@@ -37,5 +55,9 @@ in mkDerivation {
     mv $out/bin/install $out/bin/xinstall
     ln -s ./binstall $out/bin/install
   '';
-  outputs = [ "out" "man" "test" ];
+  outputs = [
+    "out"
+    "man"
+    "test"
+  ];
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix
index 935b48cca5e72..6cf2216ba05f4 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix
@@ -1,12 +1,20 @@
-{ lib, stdenv, mkDerivation
-, patchesRoot
-
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal
-, install
-, flex, byacc, gencat, rpcgen
-
-, csu, include
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  patchesRoot,
+
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  flex,
+  byacc,
+  gencat,
+  rpcgen,
+
+  csu,
+  include,
 }:
 
 mkDerivation rec {
@@ -63,13 +71,20 @@ mkDerivation rec {
   '';
 
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
+    bsdSetupHook
+    freebsdSetupHook
     makeMinimal
     install
 
-    flex byacc gencat rpcgen
+    flex
+    byacc
+    gencat
+    rpcgen
+  ];
+  buildInputs = [
+    include
+    csu
   ];
-  buildInputs = [ include csu ];
   env.NIX_CFLAGS_COMPILE = "-B${csu}/lib";
 
   # Suppress lld >= 16 undefined version errors
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libdwarf.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libdwarf.nix
index 9fc8fc5f9a624..84115b626a7af 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/libdwarf.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libdwarf.nix
@@ -1,8 +1,16 @@
-{ lib, stdenv, mkDerivation
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, install, mandoc, groff
-, m4
-, compatIfNeeded, libelf
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  m4,
+  compatIfNeeded,
+  libelf,
 }:
 
 mkDerivation {
@@ -15,13 +23,15 @@ mkDerivation {
     "sys/sys/elf_common.h"
   ];
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal install mandoc groff
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    install
+    mandoc
+    groff
 
     m4
   ];
-  buildInputs = compatIfNeeded ++ [
-    libelf
-  ];
+  buildInputs = compatIfNeeded ++ [ libelf ];
   MK_TESTS = "no";
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix
index a44ce1685e57d..881cbfcd811c8 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix
@@ -1,7 +1,14 @@
-{ lib, stdenv, mkDerivation
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, install, mandoc, groff
-, m4
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  m4,
 }:
 
 mkDerivation {
@@ -15,8 +22,12 @@ mkDerivation {
   ];
   BOOTSTRAPPING = !stdenv.isFreeBSD;
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal install mandoc groff
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    install
+    mandoc
+    groff
 
     m4
   ];
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libnetbsd/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libnetbsd/package.nix
index 0deea8b2fb7b8..80ea685a3162f 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/libnetbsd/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libnetbsd/package.nix
@@ -1,18 +1,27 @@
-{ lib, stdenv
-, mkDerivation, patchesRoot
-, bsdSetupHook, freebsdSetupHook, makeMinimal, mandoc, groff
-, boot-install, install
-, compatIfNeeded
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  patchesRoot,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  mandoc,
+  groff,
+  boot-install,
+  install,
+  compatIfNeeded,
 }:
 
 mkDerivation {
   path = "lib/libnetbsd";
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal mandoc groff
-    (if stdenv.hostPlatform == stdenv.buildPlatform
-     then boot-install
-     else install)
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    mandoc
+    groff
+    (if stdenv.hostPlatform == stdenv.buildPlatform then boot-install else install)
   ];
   patches = lib.optionals (!stdenv.hostPlatform.isFreeBSD) [
     /${patchesRoot}/libnetbsd-do-install.patch
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libsbuf.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libsbuf.nix
index 719474dbb11ac..242492a3f2f23 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/libsbuf.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libsbuf.nix
@@ -2,8 +2,6 @@
 
 mkDerivation {
   path = "lib/libsbuf";
-  extraPaths = [
-    "sys/kern"
-  ];
+  extraPaths = [ "sys/kern" ];
   MK_TESTS = "no";
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libutil.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libutil.nix
index c420d0daf8520..683396d140c2e 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/libutil.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/libutil.nix
@@ -1,7 +1,11 @@
-{ mkDerivation, lib, stdenv }:
+{
+  mkDerivation,
+  lib,
+  stdenv,
+}:
 mkDerivation {
   path = "lib/libutil";
-  extraPaths = ["lib/libc/gen"];
+  extraPaths = [ "lib/libc/gen" ];
   clangFixup = true;
   MK_TESTS = "no";
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/lorder.nix b/pkgs/os-specific/bsd/freebsd/pkgs/lorder.nix
index d1fd86ab5e463..abbe2079855ed 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/lorder.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/lorder.nix
@@ -1,5 +1,7 @@
-{ mkDerivation
-, bsdSetupHook, freebsdSetupHook
+{
+  mkDerivation,
+  bsdSetupHook,
+  freebsdSetupHook,
 }:
 
 mkDerivation rec {
@@ -13,8 +15,12 @@ mkDerivation rec {
     mv "lorder.1" "$man/share/man"
   '';
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
+    bsdSetupHook
+    freebsdSetupHook
+  ];
+  buildInputs = [ ];
+  outputs = [
+    "out"
+    "man"
   ];
-  buildInputs = [];
-  outputs = [ "out" "man" ];
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/make.nix b/pkgs/os-specific/bsd/freebsd/pkgs/make.nix
index fa1722cfec22c..ecf231c304145 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/make.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/make.nix
@@ -1,20 +1,25 @@
-{ lib, mkDerivation, stdenv }:
+{
+  lib,
+  mkDerivation,
+  stdenv,
+}:
 
 mkDerivation {
   path = "contrib/bmake";
   version = "9.2";
-  postPatch = ''
-    # make needs this to pick up our sys make files
-    export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
+  postPatch =
+    ''
+      # make needs this to pick up our sys make files
+      export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
 
-  '' + lib.optionalString stdenv.isDarwin ''
-    substituteInPlace $BSDSRCDIR/share/mk/bsd.sys.mk \
-      --replace '-Wl,--fatal-warnings' "" \
-      --replace '-Wl,--warn-shared-textrel' ""
-  '';
+    ''
+    + 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 = [ "share/mk" ]
-    ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "tools/build/mk";
+  extraPaths = [ "share/mk" ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "tools/build/mk";
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/makeMinimal.nix b/pkgs/os-specific/bsd/freebsd/pkgs/makeMinimal.nix
index e6a8e38a4acec..c510a4da4b825 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/makeMinimal.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/makeMinimal.nix
@@ -1,19 +1,24 @@
-{ lib, stdenv, mkDerivation
-, make
-, bsdSetupHook, freebsdSetupHook
+{
+  lib,
+  stdenv,
+  mkDerivation,
+  make,
+  bsdSetupHook,
+  freebsdSetupHook,
 }:
 
 mkDerivation rec {
   inherit (make) path;
 
-  buildInputs = [];
+  buildInputs = [ ];
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
+    bsdSetupHook
+    freebsdSetupHook
   ];
 
   skipIncludesPhase = true;
 
-  makeFlags = [];
+  makeFlags = [ ];
 
   postPatch = ''
     patchShebangs configure
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
index 79428626b8ec2..b5c962064fad2 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
@@ -1,78 +1,99 @@
-{ lib, stdenv, stdenvNoCC
-, compatIfNeeded
-, runCommand, rsync
-, freebsd-lib
-, source
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal
-, install, tsort, lorder, mandoc, groff
+{
+  lib,
+  stdenv,
+  stdenvNoCC,
+  compatIfNeeded,
+  runCommand,
+  rsync,
+  freebsd-lib,
+  source,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  groff,
 }:
 
-lib.makeOverridable (attrs: let
-  stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
-in stdenv'.mkDerivation (rec {
-  pname = "${attrs.pname or (baseNameOf attrs.path)}-freebsd";
-  inherit (freebsd-lib) 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
-  '';
+lib.makeOverridable (
+  attrs:
+  let
+    stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
+  in
+  stdenv'.mkDerivation (
+    rec {
+      pname = "${attrs.pname or (baseNameOf attrs.path)}-freebsd";
+      inherit (freebsd-lib) 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 freebsdSetupHook
-    makeMinimal
-    install tsort lorder mandoc groff #statHook
-  ];
-  buildInputs = compatIfNeeded;
+      nativeBuildInputs = [
+        bsdSetupHook
+        freebsdSetupHook
+        makeMinimal
+        install
+        tsort
+        lorder
+        mandoc
+        groff # statHook
+      ];
+      buildInputs = compatIfNeeded;
 
-  HOST_SH = stdenv'.shell;
+      HOST_SH = stdenv'.shell;
 
-  # Since STRIP below is the flag
-  STRIPBIN = "${stdenv.cc.bintools.targetPrefix}strip";
+      # Since STRIP below is the flag
+      STRIPBIN = "${stdenv.cc.bintools.targetPrefix}strip";
 
-  makeFlags = [
-    "STRIP=-s" # flag to install, not command
-  ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no";
+      makeFlags = [
+        "STRIP=-s" # flag to install, not command
+      ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no";
 
-  # amd64 not x86_64 for this on unlike NetBSD
-  MACHINE_ARCH = freebsd-lib.mkBsdArch stdenv';
+      # amd64 not x86_64 for this on unlike NetBSD
+      MACHINE_ARCH = freebsd-lib.mkBsdArch stdenv';
 
-  MACHINE = freebsd-lib.mkBsdArch stdenv';
+      MACHINE = freebsd-lib.mkBsdArch stdenv';
 
-  MACHINE_CPUARCH = MACHINE_ARCH;
+      MACHINE_CPUARCH = MACHINE_ARCH;
 
-  COMPONENT_PATH = attrs.path or null;
+      COMPONENT_PATH = attrs.path or null;
 
-  strictDeps = true;
+      strictDeps = true;
 
-  meta = with lib; {
-    maintainers = with maintainers; [ ericson2314 ];
-    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))
+      meta = with lib; {
+        maintainers = with maintainers; [ ericson2314 ];
+        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
+  )
+)
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/mknod.nix b/pkgs/os-specific/bsd/freebsd/pkgs/mknod.nix
index 56dff7d606bd9..bf7d8b7db689b 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/mknod.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/mknod.nix
@@ -1,5 +1,3 @@
 { mkDerivation }:
 
-mkDerivation {
-  path = "sbin/mknod";
-}
+mkDerivation { path = "sbin/mknod"; }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/rpcgen/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/rpcgen/package.nix
index c2e64cb36601f..409064f2b65dc 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/rpcgen/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/rpcgen/package.nix
@@ -1,4 +1,9 @@
-{ lib, mkDerivation, stdenv, patchesRoot }:
+{
+  lib,
+  mkDerivation,
+  stdenv,
+  patchesRoot,
+}:
 
 mkDerivation rec {
   path = "usr.bin/rpcgen";
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/stat.nix b/pkgs/os-specific/bsd/freebsd/pkgs/stat.nix
index c730f00869f8e..a801ab895441c 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/stat.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/stat.nix
@@ -1,13 +1,22 @@
-{ mkDerivation
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, install, mandoc, groff
+{
+  mkDerivation,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
 }:
 
 # Don't add this to nativeBuildInputs directly.  Use statHook instead.
 mkDerivation {
   path = "usr.bin/stat";
   nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal install mandoc groff
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    install
+    mandoc
+    groff
   ];
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/statHook.nix b/pkgs/os-specific/bsd/freebsd/pkgs/statHook.nix
index 07129938b0953..4609c004e6f51 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/statHook.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/statHook.nix
@@ -1,12 +1,16 @@
-{ 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
 # breaks stdenv.  Work around that with a hook that will point
 # 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/freebsd/pkgs/sys/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/sys/package.nix
index ab0edbabceab9..50fff7738919b 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/sys/package.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/sys/package.nix
@@ -1,67 +1,92 @@
-{ stdenv, mkDerivation, freebsd-lib, patchesRoot
-, buildPackages
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, install, mandoc, groff
-, config, rpcgen, file2c, gawk, uudecode, xargs-j #, ctfconvert
+{
+  stdenv,
+  mkDerivation,
+  freebsd-lib,
+  patchesRoot,
+  buildPackages,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  config,
+  rpcgen,
+  file2c,
+  gawk,
+  uudecode,
+  xargs-j, # , ctfconvert
 }:
 
-mkDerivation (let
-  cfg = "MINIMAL";
-in rec {
-  path = "sys";
-
-  nativeBuildInputs = [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal install mandoc groff
-
-    config rpcgen file2c gawk uudecode xargs-j
-    #ctfconvert
-  ];
-
-  patches = [
-    /${patchesRoot}/sys-gnu-date.patch
-    /${patchesRoot}/sys-no-explicit-intrinsics-dep.patch
-  ];
-
-  # --dynamic-linker /red/herring is used when building the kernel.
-  NIX_ENFORCE_PURITY = 0;
-
-  AWK = "${buildPackages.gawk}/bin/awk";
-
-  CWARNEXTRA = "-Wno-error=shift-negative-value -Wno-address-of-packed-member";
-
-  MK_CTF = "no";
-
-  KODIR = "${builtins.placeholder "out"}/kernel";
-  KMODDIR = "${builtins.placeholder "out"}/kernel";
-  DTBDIR = "${builtins.placeholder"out"}/dbt";
-
-  KERN_DEBUGDIR = "${builtins.placeholder "out"}/debug";
-  KERN_DEBUGDIR_KODIR = "${KERN_DEBUGDIR}/kernel";
-  KERN_DEBUGDIR_KMODDIR = "${KERN_DEBUGDIR}/kernel";
-
-  skipIncludesPhase = true;
-
-  configurePhase = ''
-    runHook preConfigure
-
-    for f in conf/kmod.mk contrib/dev/acpica/acpica_prep.sh; do
-      substituteInPlace "$f" --replace 'xargs -J' 'xargs-j '
-    done
-
-    for f in conf/*.mk; do
-      substituteInPlace "$f" --replace 'KERN_DEBUGDIR}''${' 'KERN_DEBUGDIR_'
-    done
-
-    cd ${freebsd-lib.mkBsdArch stdenv}/conf
-    sed -i ${cfg} \
-      -e 's/WITH_CTF=1/WITH_CTF=0/' \
-      -e '/KDTRACE/d'
-    config ${cfg}
-
-    runHook postConfigure
-  '';
-  preBuild = ''
-    cd ../compile/${cfg}
-  '';
-})
+mkDerivation (
+  let
+    cfg = "MINIMAL";
+  in
+  rec {
+    path = "sys";
+
+    nativeBuildInputs = [
+      bsdSetupHook
+      freebsdSetupHook
+      makeMinimal
+      install
+      mandoc
+      groff
+
+      config
+      rpcgen
+      file2c
+      gawk
+      uudecode
+      xargs-j
+      #ctfconvert
+    ];
+
+    patches = [
+      /${patchesRoot}/sys-gnu-date.patch
+      /${patchesRoot}/sys-no-explicit-intrinsics-dep.patch
+    ];
+
+    # --dynamic-linker /red/herring is used when building the kernel.
+    NIX_ENFORCE_PURITY = 0;
+
+    AWK = "${buildPackages.gawk}/bin/awk";
+
+    CWARNEXTRA = "-Wno-error=shift-negative-value -Wno-address-of-packed-member";
+
+    MK_CTF = "no";
+
+    KODIR = "${builtins.placeholder "out"}/kernel";
+    KMODDIR = "${builtins.placeholder "out"}/kernel";
+    DTBDIR = "${builtins.placeholder "out"}/dbt";
+
+    KERN_DEBUGDIR = "${builtins.placeholder "out"}/debug";
+    KERN_DEBUGDIR_KODIR = "${KERN_DEBUGDIR}/kernel";
+    KERN_DEBUGDIR_KMODDIR = "${KERN_DEBUGDIR}/kernel";
+
+    skipIncludesPhase = true;
+
+    configurePhase = ''
+      runHook preConfigure
+
+      for f in conf/kmod.mk contrib/dev/acpica/acpica_prep.sh; do
+        substituteInPlace "$f" --replace 'xargs -J' 'xargs-j '
+      done
+
+      for f in conf/*.mk; do
+        substituteInPlace "$f" --replace 'KERN_DEBUGDIR}''${' 'KERN_DEBUGDIR_'
+      done
+
+      cd ${freebsd-lib.mkBsdArch stdenv}/conf
+      sed -i ${cfg} \
+        -e 's/WITH_CTF=1/WITH_CTF=0/' \
+        -e '/KDTRACE/d'
+      config ${cfg}
+
+      runHook postConfigure
+    '';
+    preBuild = ''
+      cd ../compile/${cfg}
+    '';
+  }
+)
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/tsort.nix b/pkgs/os-specific/bsd/freebsd/pkgs/tsort.nix
index cdc1b27ce8fed..ab0101789f491 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/tsort.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/tsort.nix
@@ -1,12 +1,21 @@
-{ mkDerivation
-, bsdSetupHook, freebsdSetupHook
-, makeMinimal, install, mandoc, groff
+{
+  mkDerivation,
+  bsdSetupHook,
+  freebsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
 }:
 
 mkDerivation {
   path = "usr.bin/tsort";
-  nativeBuildInputs =  [
-    bsdSetupHook freebsdSetupHook
-    makeMinimal install mandoc groff
+  nativeBuildInputs = [
+    bsdSetupHook
+    freebsdSetupHook
+    makeMinimal
+    install
+    mandoc
+    groff
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix
index fd5e24aa7102a..e0d03108960c0 100644
--- a/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/pkgs/os-specific/bsd/netbsd/default.nix
@@ -1,137 +1,187 @@
-{ stdenv, lib, stdenvNoCC
-, makeScopeWithSplicing', generateSplicesForMkScope
-, buildPackages
-, fetchcvs
+{
+  stdenv,
+  lib,
+  stdenvNoCC,
+  makeScopeWithSplicing',
+  generateSplicesForMkScope,
+  buildPackages,
+  fetchcvs,
 }:
 
 makeScopeWithSplicing' {
   otherSplices = generateSplicesForMkScope "netbsd";
-  f = (self: lib.packagesFromDirectoryRecursive {
-    callPackage = self.callPackage;
-    directory = ./pkgs;
-  } // (let inherit (self) mkDerivation; in {
-
-    fetchNetBSD = path: version: sha256: fetchcvs {
-      cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot";
-      module = "src/${path}";
-      inherit sha256;
-      tag = "netbsd-${lib.replaceStrings ["."] ["-"] version}-RELEASE";
-    };
-
-    defaultMakeFlags = [
-      "MKSOFTFLOAT=${if stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft"
-        then "yes"
-        else "no"}"
-    ];
-
-    compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isNetBSD) self.compat;
-
-    # The manual callPackages below should in principle be unnecessary because
-    # they're just selecting arguments that would be selected anyway. However,
-    # if we don't perform these manual calls, we get infinite recursion issues
-    # because of the splices.
-
-    mkDerivation = self.callPackage ./pkgs/mkDerivation.nix {
-      inherit stdenv stdenvNoCC;
-      inherit (buildPackages.netbsd) netbsdSetupHook makeMinimal install tsort lorder;
-      inherit (buildPackages) mandoc;
-      inherit (buildPackages.buildPackages) rsync;
-
-    };
-
-    makeMinimal = self.callPackage ./pkgs/makeMinimal.nix {
-      inherit (self) make;
-    };
-
-    compat = self.callPackage ./pkgs/compat/package.nix {
-      inherit (buildPackages) coreutils;
-      inherit (buildPackages.darwin) cctools-port;
-      inherit (buildPackages.buildPackages) rsync;
-      inherit (buildPackages.netbsd) makeMinimal;
-      inherit (self) install include libc libutil;
-    };
-
-    install = self.callPackage ./pkgs/install/package.nix {
-      inherit (self) fts mtree make compatIfNeeded;
-      inherit (buildPackages.buildPackages) rsync;
-      inherit (buildPackages.netbsd) makeMinimal;
-    };
-
-    # See note in pkgs/stat/package.nix
-    stat = self.callPackage ./pkgs/stat/package.nix {
-      inherit (buildPackages.netbsd) makeMinimal install;
-      inherit (buildPackages.buildPackages) rsync;
-    };
-
-    # See note in pkgs/stat/hook.nix
-    statHook = self.callPackage ./pkgs/stat/hook.nix {
-      inherit (self) stat;
-    };
-
-    tsort = self.callPackage ./pkgs/tsort.nix {
-      inherit (buildPackages.netbsd) makeMinimal install;
-      inherit (buildPackages.buildPackages) rsync;
-    };
-
-    lorder = self.callPackage ./pkgs/lorder.nix {
-      inherit (buildPackages.netbsd) makeMinimal install;
-      inherit (buildPackages.buildPackages) rsync;
-    };
-
-    config = self.callPackage ./pkgs/config.nix {
-      inherit (buildPackages.netbsd) makeMinimal install;
-      inherit (buildPackages.buildPackages) rsync;
-      inherit (self) cksum;
-    };
-
-    include = self.callPackage ./pkgs/include.nix {
-      inherit (buildPackages.netbsd)
-        makeMinimal install nbperf rpcgen;
-      inherit (buildPackages) stdenv;
-      inherit (buildPackages.buildPackages) rsync;
-    };
-
-    sys-headers = self.callPackage ./pkgs/sys/headers.nix {
-      inherit (buildPackages.netbsd)
-        makeMinimal install tsort lorder statHook uudecode config genassym;
-      inherit (buildPackages.buildPackages) rsync;
-    };
-
-    libutil = self.callPackage ./pkgs/libutil.nix {
-      inherit (self) libc sys;
-    };
-
-    libpthread-headers = self.callPackage ./pkgs/libpthread/headers.nix { };
-
-    csu = self.callPackage ./pkgs/csu.nix {
-      inherit (self) headers sys ld_elf_so;
-      inherit (buildPackages.netbsd)
-        netbsdSetupHook
-        makeMinimal
-        install
-        genassym gencat lorder tsort statHook;
-      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
-    ];
-
-    libc = self.callPackage ./pkgs/libc.nix {
-      inherit (self) headers csu librt;
-      inherit (buildPackages.netbsd)
-        netbsdSetupHook
-        makeMinimal
-        install
-        genassym gencat lorder tsort statHook rpcgen;
-      inherit (buildPackages.buildPackages) rsync;
-    };
-
-    mtree = self.callPackage ./pkgs/mtree.nix {
-      inherit (self) mknod;
-    };
-
-  }));
+  f = (
+    self:
+    lib.packagesFromDirectoryRecursive {
+      callPackage = self.callPackage;
+      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";
+        };
+
+      defaultMakeFlags = [
+        "MKSOFTFLOAT=${
+          if stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft" then
+            "yes"
+          else
+            "no"
+        }"
+      ];
+
+      compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isNetBSD) self.compat;
+
+      # The manual callPackages below should in principle be unnecessary because
+      # they're just selecting arguments that would be selected anyway. However,
+      # if we don't perform these manual calls, we get infinite recursion issues
+      # because of the splices.
+
+      mkDerivation = self.callPackage ./pkgs/mkDerivation.nix {
+        inherit stdenv stdenvNoCC;
+        inherit (buildPackages.netbsd)
+          netbsdSetupHook
+          makeMinimal
+          install
+          tsort
+          lorder
+          ;
+        inherit (buildPackages) mandoc;
+        inherit (buildPackages.buildPackages) rsync;
+      };
+
+      makeMinimal = self.callPackage ./pkgs/makeMinimal.nix { inherit (self) make; };
+
+      compat = self.callPackage ./pkgs/compat/package.nix {
+        inherit (buildPackages) coreutils;
+        inherit (buildPackages.darwin) cctools-port;
+        inherit (buildPackages.buildPackages) rsync;
+        inherit (buildPackages.netbsd) makeMinimal;
+        inherit (self)
+          install
+          include
+          libc
+          libutil
+          ;
+      };
+
+      install = self.callPackage ./pkgs/install/package.nix {
+        inherit (self)
+          fts
+          mtree
+          make
+          compatIfNeeded
+          ;
+        inherit (buildPackages.buildPackages) rsync;
+        inherit (buildPackages.netbsd) makeMinimal;
+      };
+
+      # See note in pkgs/stat/package.nix
+      stat = self.callPackage ./pkgs/stat/package.nix {
+        inherit (buildPackages.netbsd) makeMinimal install;
+        inherit (buildPackages.buildPackages) rsync;
+      };
+
+      # See note in pkgs/stat/hook.nix
+      statHook = self.callPackage ./pkgs/stat/hook.nix { inherit (self) stat; };
+
+      tsort = self.callPackage ./pkgs/tsort.nix {
+        inherit (buildPackages.netbsd) makeMinimal install;
+        inherit (buildPackages.buildPackages) rsync;
+      };
+
+      lorder = self.callPackage ./pkgs/lorder.nix {
+        inherit (buildPackages.netbsd) makeMinimal install;
+        inherit (buildPackages.buildPackages) rsync;
+      };
+
+      config = self.callPackage ./pkgs/config.nix {
+        inherit (buildPackages.netbsd) makeMinimal install;
+        inherit (buildPackages.buildPackages) rsync;
+        inherit (self) cksum;
+      };
+
+      include = self.callPackage ./pkgs/include.nix {
+        inherit (buildPackages.netbsd)
+          makeMinimal
+          install
+          nbperf
+          rpcgen
+          ;
+        inherit (buildPackages) stdenv;
+        inherit (buildPackages.buildPackages) rsync;
+      };
+
+      sys-headers = self.callPackage ./pkgs/sys/headers.nix {
+        inherit (buildPackages.netbsd)
+          makeMinimal
+          install
+          tsort
+          lorder
+          statHook
+          uudecode
+          config
+          genassym
+          ;
+        inherit (buildPackages.buildPackages) rsync;
+      };
+
+      libutil = self.callPackage ./pkgs/libutil.nix { inherit (self) libc sys; };
+
+      libpthread-headers = self.callPackage ./pkgs/libpthread/headers.nix { };
+
+      csu = self.callPackage ./pkgs/csu.nix {
+        inherit (self) headers sys ld_elf_so;
+        inherit (buildPackages.netbsd)
+          netbsdSetupHook
+          makeMinimal
+          install
+          genassym
+          gencat
+          lorder
+          tsort
+          statHook
+          ;
+        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
+      ];
+
+      libc = self.callPackage ./pkgs/libc.nix {
+        inherit (self) headers csu librt;
+        inherit (buildPackages.netbsd)
+          netbsdSetupHook
+          makeMinimal
+          install
+          genassym
+          gencat
+          lorder
+          tsort
+          statHook
+          rpcgen
+          ;
+        inherit (buildPackages.buildPackages) rsync;
+      };
+
+      mtree = self.callPackage ./pkgs/mtree.nix { inherit (self) mknod; };
+    }
+  );
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
index a1336ad52f6dc..4c149e95c1ae6 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/compat/package.nix
@@ -1,21 +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,
+  include,
+  libc,
+  libutil,
+  install,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  rsync,
+  fetchNetBSD,
+  _mainLibcExtraPaths,
 }:
 
-mkDerivation (let
+mkDerivation (
+  let
     version = "9.2";
     commonDeps = [ zlib ];
-  in {
+  in
+  {
     path = "tools/compat";
     sha256 = "1vsxg7136nlhc72vpa664vs22874xh7ila95nkmsd8crn3z3cyn0";
     inherit version;
@@ -29,19 +37,23 @@ 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
     ];
@@ -50,22 +62,27 @@ mkDerivation (let
 
     # 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=$(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"
+      ];
     RENAME = "-D";
 
-    passthru.tests = { netbsd-install = install; };
+    passthru.tests = {
+      netbsd-install = install;
+    };
 
     patches = [
       ./compat-cxx-safe-header.patch
@@ -79,42 +96,51 @@ 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 $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
 
-      # 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
+        # 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")
+      (fetchNetBSD "common/include/rpc/types.h" "9.2"
+        "0n2df12mlc3cbc48jxq35yzl1y7ghgpykvy7jnfh898rdhac7m9a"
+      )
     ] ++ libutil.extraPaths ++ _mainLibcExtraPaths;
-  })
+  }
+)
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/config.nix b/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
index 277d70129e6f7..c423f3ca86760 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/config.nix
@@ -1,8 +1,15 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal, install, mandoc, byacc, flex, rsync
-, compatIfNeeded
-, cksum
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  byacc,
+  flex,
+  rsync,
+  compatIfNeeded,
+  cksum,
 }:
 mkDerivation {
   path = "usr.bin/config";
@@ -10,8 +17,14 @@ mkDerivation {
   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
+    rsync
   ];
   buildInputs = compatIfNeeded;
   extraPaths = [ cksum.src ];
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
index 2d13ced6d5ed5..66443331490f5 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
@@ -1,11 +1,23 @@
-{ 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,
+  rsync,
+  headers,
+  sys,
+  ld_elf_so,
 }:
 
 mkDerivation {
@@ -14,11 +26,24 @@ mkDerivation {
   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
+    rsync
   ];
   buildInputs = [ headers ];
-  extraPaths = [ sys.src ld_elf_so.src ];
+  extraPaths = [
+    sys.src
+    ld_elf_so.src
+  ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix
index 0393d36357f6e..7c64658bf2e51 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/fts/package.nix
@@ -1,7 +1,10 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook, rsync
-, compatIfNeeded
-, fetchNetBSD
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  rsync,
+  compatIfNeeded,
+  fetchNetBSD,
 }:
 
 mkDerivation {
@@ -10,12 +13,16 @@ mkDerivation {
   sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
   version = "9.2";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook rsync
+    bsdSetupHook
+    netbsdSetupHook
+    rsync
   ];
   propagatedBuildInputs = compatIfNeeded;
   extraPaths = [
     (fetchNetBSD "lib/libc/gen/fts.c" "9.2" "1a8hmf26242nmv05ipn3ircxb0jqmmi66rh78kkyi9vjwkfl3qn7")
-    (fetchNetBSD "lib/libc/include/namespace.h" "9.2" "0kksr3pdwdc1cplqf5z12ih4cml6l11lqrz91f7hjjm64y7785kc")
+    (fetchNetBSD "lib/libc/include/namespace.h" "9.2"
+      "0kksr3pdwdc1cplqf5z12ih4cml6l11lqrz91f7hjjm64y7785kc"
+    )
     (fetchNetBSD "lib/libc/gen/fts.3" "9.2" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1")
   ];
   skipIncludesPhase = true;
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..c76ada865775e 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/i18n_module.nix
@@ -1,4 +1,8 @@
-{ lib, mkDerivation, libc }:
+{
+  lib,
+  mkDerivation,
+  libc,
+}:
 
 mkDerivation {
   path = "lib/i18n_module";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
index 1ecdec90ae095..ec316a63174fd 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
@@ -1,10 +1,18 @@
-{ lib, mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, rsync, nbperf, rpcgen
-, common
-, defaultMakeFlags
-, stdenv
+{
+  lib,
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  rsync,
+  nbperf,
+  rpcgen,
+  common,
+  defaultMakeFlags,
+  stdenv,
 }:
 
 mkDerivation {
@@ -12,9 +20,15 @@ mkDerivation {
   version = "9.2";
   sha256 = "0nxnmj4c8s3hb9n3fpcmd0zl3l1nmhivqgi9a35sis943qvpgl9h";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff rsync nbperf rpcgen
+    install
+    mandoc
+    groff
+    rsync
+    nbperf
+    rpcgen
   ];
 
   # The makefiles define INCSDIR per subdirectory, so we have to set
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix b/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
index 991517ac2d486..69b0c073259e2 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/install/package.nix
@@ -1,10 +1,16 @@
-{ mkDerivation
-, writeShellScript
-, mtree, make
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, mandoc, groff, rsync
-, compatIfNeeded, fts
+{
+  mkDerivation,
+  writeShellScript,
+  mtree,
+  make,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  mandoc,
+  groff,
+  rsync,
+  compatIfNeeded,
+  fts,
 
 }:
 
@@ -18,32 +24,39 @@ let
     @out@/bin/xinstall "$@"
   '';
 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";
+  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
 
-      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..a350e81d32064 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
@@ -1,11 +1,12 @@
-{ lib
-, mkDerivation
-, libc
-, defaultMakeFlags
+{
+  lib,
+  mkDerivation,
+  libc,
+  defaultMakeFlags,
 }:
 
 mkDerivation {
-  path  = "libexec/ld.elf_so";
+  path = "libexec/ld.elf_so";
   version = "9.2";
   sha256 = "0ia9mqzdljly0vqfwflm5mzz55k7qsr4rw2bzhivky6k30vgirqa";
   meta.platforms = lib.platforms.netbsd;
@@ -13,6 +14,9 @@ mkDerivation {
   # Hack to prevent a symlink being installed here for compatibility.
   SHLINKINSTALLDIR = "/usr/libexec";
   USE_FORT = "yes";
-  makeFlags = defaultMakeFlags ++ [ "BINDIR=$(out)/libexec" "CLIBOBJ=${libc}/lib" ];
+  makeFlags = defaultMakeFlags ++ [
+    "BINDIR=$(out)/libexec"
+    "CLIBOBJ=${libc}/lib"
+  ];
   extraPaths = [ libc.src ] ++ libc.extraPaths;
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
index ebc01a11668a6..d755e4b6870a1 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
@@ -1,14 +1,27 @@
-{ lib
-, mkDerivation
-, defaultMakeFlags
-, _mainLibcExtraPaths
-, fetchNetBSD
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, flex
-, byacc, genassym, gencat, lorder, tsort, statHook, rsync, rpcgen
-, csu, headers
-, librt
+{
+  lib,
+  mkDerivation,
+  defaultMakeFlags,
+  _mainLibcExtraPaths,
+  fetchNetBSD,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  flex,
+  byacc,
+  genassym,
+  gencat,
+  lorder,
+  tsort,
+  statHook,
+  rsync,
+  rpcgen,
+  csu,
+  headers,
+  librt,
 }:
 
 mkDerivation {
@@ -21,18 +34,32 @@ mkDerivation {
     (fetchNetBSD "external/bsd/jemalloc" "9.2" "0cq704swa0h2yxv4gc79z2lwxibk9k7pxh3q5qfs7axx3jx3n8kb")
   ];
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff flex
-    byacc genassym gencat lorder tsort statHook rsync rpcgen
+    install
+    mandoc
+    groff
+    flex
+    byacc
+    genassym
+    gencat
+    lorder
+    tsort
+    statHook
+    rsync
+    rpcgen
+  ];
+  buildInputs = [
+    headers
+    csu
   ];
-  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"];
+  makeFlags = defaultMakeFlags ++ [ "FILESDIR=$(out)/var/db" ];
   postInstall = ''
     pushd ${headers}
     find . -type d -exec mkdir -p $out/\{} \;
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix
index 2409879640a90..5072821db9117 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libcurses.nix
@@ -1,7 +1,10 @@
-{ lib, mkDerivation, stdenv
-, libterminfo
-, compatIfNeeded
-, defaultMakeFlags
+{
+  lib,
+  mkDerivation,
+  stdenv,
+  libterminfo,
+  compatIfNeeded,
+  defaultMakeFlags,
 }:
 
 mkDerivation {
@@ -9,11 +12,14 @@ mkDerivation {
   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..ee1e7bf79f964 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libedit.nix
@@ -1,26 +1,32 @@
-{ 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";
+  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"
+  ];
+}
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
index 86990088adf28..f36e97f8e6ae0 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libm.nix
@@ -1,4 +1,8 @@
-{ lib, mkDerivation, sys }:
+{
+  lib,
+  mkDerivation,
+  sys,
+}:
 
 mkDerivation {
   path = "lib/libm";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix
index 21ca0f62fd4e4..b0be4a2da723a 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpci.nix
@@ -1,4 +1,8 @@
-{ lib, mkDerivation, sys }:
+{
+  lib,
+  mkDerivation,
+  sys,
+}:
 
 mkDerivation {
   pname = "libpci";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix
index 485a12837bcb4..d8ea7c553eba3 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/base.nix
@@ -3,4 +3,3 @@
   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..c3cc899017eee 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/headers.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/headers.nix
@@ -1,9 +1,12 @@
 { lib, mkDerivation }:
 
-mkDerivation (import ./base.nix // {
-  pname = "libpthread-headers";
-  installPhase = "includesPhase";
-  dontBuild = true;
-  noCC = true;
-  meta.platforms = lib.platforms.netbsd;
-})
+mkDerivation (
+  import ./base.nix
+  // {
+    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..88d392e20b4a8 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libpthread/package.nix
@@ -1,15 +1,28 @@
-{ lib, mkDerivation
-, headers
-, common, libc, librt, sys
+{
+  lib,
+  mkDerivation,
+  headers,
+  common,
+  libc,
+  librt,
+  sys,
 }:
 
-mkDerivation (import ./base.nix // {
-  pname = "libpthread";
-  installPhase = null;
-  noCC = false;
-  dontBuild = false;
-  buildInputs = [ headers ];
-  SHLIBINSTALLDIR = "$(out)/lib";
-  extraPaths = [ common libc.src librt.src sys.src ];
-  meta.platforms = lib.platforms.netbsd;
-})
+mkDerivation (
+  import ./base.nix
+  // {
+    pname = "libpthread";
+    installPhase = null;
+    noCC = false;
+    dontBuild = false;
+    buildInputs = [ headers ];
+    SHLIBINSTALLDIR = "$(out)/lib";
+    extraPaths = [
+      common
+      libc.src
+      librt.src
+      sys.src
+    ];
+    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..24bc4f2f9e002 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libresolv.nix
@@ -1,4 +1,8 @@
-{ lib, mkDerivation, libc }:
+{
+  lib,
+  mkDerivation,
+  libc,
+}:
 
 mkDerivation {
   path = "lib/libresolv";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix b/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
index 87524339e268f..8d757a8a84304 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/librpcsvc.nix
@@ -1,9 +1,15 @@
-{ lib
-, mkDerivation
-, defaultMakeFlags
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, tsort, lorder, rpcgen, statHook
+{
+  lib,
+  mkDerivation,
+  defaultMakeFlags,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  rpcgen,
+  statHook,
 }:
 
 mkDerivation {
@@ -13,9 +19,13 @@ mkDerivation {
   makeFlags = defaultMakeFlags ++ [ "INCSDIR=$(out)/include/rpcsvc" ];
   meta.platforms = lib.platforms.netbsd;
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install tsort lorder rpcgen statHook
+    install
+    tsort
+    lorder
+    rpcgen
+    statHook
   ];
 }
-
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
index 2ffe0787004a5..fa0229953b66b 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
@@ -1,4 +1,9 @@
-{ lib, mkDerivation, libc, headers }:
+{
+  lib,
+  mkDerivation,
+  libc,
+  headers,
+}:
 
 mkDerivation {
   path = "lib/librt";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix
index b9268cc7ba333..6ac573d865b1a 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libterminfo.nix
@@ -1,8 +1,18 @@
-{ 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,
+  rsync,
+  compatIfNeeded,
+  fetchNetBSD,
 }:
 
 mkDerivation {
@@ -10,8 +20,17 @@ mkDerivation {
   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
+    rsync
   ];
   buildInputs = compatIfNeeded;
   SHLIBINSTALLDIR = "$(out)/lib";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix
index 4aaf8f0e7ab63..fdc57df9c231e 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libutil.nix
@@ -1,20 +1,41 @@
-{ mkDerivation
-, common, libc, sys
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, byacc, install, tsort, lorder, mandoc, statHook, rsync
-, headers
+{
+  mkDerivation,
+  common,
+  libc,
+  sys,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  byacc,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  statHook,
+  rsync,
+  headers,
 }:
 
 mkDerivation {
   path = "lib/libutil";
   version = "9.2";
   sha256 = "02gm5a5zhh8qp5r5q5r7x8x6x50ir1i0ncgsnfwh1vnrz6mxbq7z";
-  extraPaths = [ common libc.src sys.src ];
+  extraPaths = [
+    common
+    libc.src
+    sys.src
+  ];
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    byacc install tsort lorder mandoc statHook rsync
+    byacc
+    install
+    tsort
+    lorder
+    mandoc
+    statHook
+    rsync
   ];
   buildInputs = [ headers ];
   SHLIBINSTALLDIR = "$(out)/lib";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix b/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix
index d3109601382a0..0b99a794b07a0 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/lorder.nix
@@ -1,7 +1,12 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, rsync
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  rsync,
 }:
 
 mkDerivation {
@@ -9,8 +14,12 @@ mkDerivation {
   version = "9.2";
   sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff rsync
+    install
+    mandoc
+    groff
+    rsync
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/make.nix b/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
index dcd80ef004678..381e30916407b 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/make.nix
@@ -1,56 +1,63 @@
-{ lib, mkDerivation, fetchNetBSD, stdenv }:
+{
+  lib,
+  mkDerivation,
+  fetchNetBSD,
+  stdenv,
+}:
 
 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 =
+    ''
+      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}' ""
 
-    # make needs this to pick up our sys make files
-    export 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' ""
-  '';
+       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
   '';
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix b/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix
index 18655b3bf863e..585c72bd17987 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/makeMinimal.nix
@@ -1,6 +1,9 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook, rsync
-, make
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  rsync,
+  make,
 }:
 
 mkDerivation {
@@ -8,9 +11,11 @@ mkDerivation {
   sha256 = "0fh0nrnk18m613m5blrliq2aydciv51qhc0ihsj4k63incwbk90n";
   version = "9.2";
 
-  buildInputs = [];
+  buildInputs = [ ];
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook rsync
+    bsdSetupHook
+    netbsdSetupHook
+    rsync
   ];
 
   skipIncludesPhase = true;
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
index 82e8889f6cf4d..849d2b1da3fbf 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
@@ -1,82 +1,113 @@
-{ lib
-, stdenvNoCC, stdenv
-, fetchNetBSD
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, tsort, lorder
-, mandoc, groff, statHook, rsync
-, compatIfNeeded
-, defaultMakeFlags
+{
+  lib,
+  stdenvNoCC,
+  stdenv,
+  fetchNetBSD,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  tsort,
+  lorder,
+  mandoc,
+  groff,
+  statHook,
+  rsync,
+  compatIfNeeded,
+  defaultMakeFlags,
 }:
 
-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 stdenv;
+  in
+  stdenv'.mkDerivation (
+    {
+      pname = "${attrs.pname or (baseNameOf attrs.path)}-netbsd";
+      inherit (attrs) version;
+      src = fetchNetBSD attrs.path attrs.version attrs.sha256;
 
-  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
+        rsync
+      ];
+      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/nbperf.nix b/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix
index 02ce7cf6ce5eb..a23c5dddfc9f8 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/nbperf.nix
@@ -5,4 +5,3 @@ mkDerivation {
   version = "9.2";
   sha256 = "1nxc302vgmjhm3yqdivqyfzslrg0vjpbss44s74rcryrl19mma9r";
 }
-
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/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..397b1f5303c15 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/stat/package.nix
@@ -1,7 +1,12 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, rsync
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  rsync,
 }:
 
 # Don't add this to nativeBuildInputs directly.
@@ -12,8 +17,12 @@ mkDerivation {
   version = "9.2";
   sha256 = "18nqwlndfc34qbbgqx5nffil37jfq9aw663ippasfxd2hlyc106x";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff rsync
+    install
+    mandoc
+    groff
+    rsync
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix b/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
index ba458ef5c712f..4c140fa3bdef7 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
@@ -1,9 +1,20 @@
-{ 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,
+  rsync,
+  uudecode,
+  config,
+  genassym,
+  defaultMakeFlags,
+  common,
 }:
 {
   path = "sys";
@@ -29,23 +40,34 @@
     ''
       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
+    rsync
+    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;
 
@@ -68,5 +90,4 @@
 
   meta.platforms = lib.platforms.netbsd;
   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..2df35efc199ad 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/headers.nix
@@ -1,21 +1,49 @@
-{ 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,
+  rsync,
+  uudecode,
+  config,
+  genassym,
+  defaultMakeFlags,
+  common,
 }:
 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
+      rsync
+      uudecode
+      config
+      genassym
+      defaultMakeFlags
+      common
+      ;
   };
 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..c8e6edab5f48f 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/package.nix
@@ -1,21 +1,49 @@
-{ 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,
+  rsync,
+  uudecode,
+  config,
+  genassym,
+  defaultMakeFlags,
+  common,
 }:
 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
+      rsync
+      uudecode
+      config
+      genassym
+      defaultMakeFlags
+      common
+      ;
   };
 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..e0900652108fd 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/tic.nix
@@ -1,11 +1,17 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, nbperf, rsync
-, compatIfNeeded
-, defaultMakeFlags
-, libterminfo
-, fetchNetBSD
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  nbperf,
+  rsync,
+  compatIfNeeded,
+  defaultMakeFlags,
+  libterminfo,
+  fetchNetBSD,
 }:
 
 mkDerivation {
@@ -15,9 +21,14 @@ mkDerivation {
   HOSTPROG = "tic";
   buildInputs = compatIfNeeded;
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff nbperf rsync
+    install
+    mandoc
+    groff
+    nbperf
+    rsync
   ];
   makeFlags = defaultMakeFlags ++ [ "TOOLDIR=$(out)" ];
   extraPaths = [
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix b/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix
index 334eccc64c551..9200bc57a73e0 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/tsort.nix
@@ -1,7 +1,12 @@
-{ mkDerivation
-, bsdSetupHook, netbsdSetupHook
-, makeMinimal
-, install, mandoc, groff, rsync
+{
+  mkDerivation,
+  bsdSetupHook,
+  netbsdSetupHook,
+  makeMinimal,
+  install,
+  mandoc,
+  groff,
+  rsync,
 }:
 
 mkDerivation {
@@ -9,8 +14,12 @@ mkDerivation {
   version = "9.2";
   sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq";
   nativeBuildInputs = [
-    bsdSetupHook netbsdSetupHook
+    bsdSetupHook
+    netbsdSetupHook
     makeMinimal
-    install mandoc groff rsync
+    install
+    mandoc
+    groff
+    rsync
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix b/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
index dac9674f9d6f3..7592db3eaf180 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/uudecode.nix
@@ -1,4 +1,8 @@
-{ lib, mkDerivation, stdenv }:
+{
+  lib,
+  mkDerivation,
+  stdenv,
+}:
 
 mkDerivation {
   path = "usr.bin/uudecode";
@@ -7,4 +11,3 @@ mkDerivation {
   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isLinux "-DNO_BASE64";
   NIX_LDFLAGS = lib.optional stdenv.isDarwin "-lresolv";
 }
-