about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMatthew Justin Bauer <mjbauer95@gmail.com>2018-04-29 14:28:04 -0500
committerGitHub <noreply@github.com>2018-04-29 14:28:04 -0500
commitd7e563779184a832ca371ca964b7b690e63c11ab (patch)
tree16813202ca02d8879b01e29113a9deec3694e374 /pkgs
parent6cc732ebbee991cdaf35063574a664d9adcd0950 (diff)
parent0be5637139970d5ae6aef1999769b600765a95f6 (diff)
Merge pull request #39636 from matthewbauer/netbsd
netbsd: cleanups
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/os-specific/bsd/default.nix3
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix261
-rw-r--r--pkgs/os-specific/bsd/openbsd/default.nix42
-rw-r--r--pkgs/os-specific/bsd/openbsd/nc.patch421
-rw-r--r--pkgs/top-level/all-packages.nix2
5 files changed, 192 insertions, 537 deletions
diff --git a/pkgs/os-specific/bsd/default.nix b/pkgs/os-specific/bsd/default.nix
index a8301ea2a8fcd..a75c132b55a2d 100644
--- a/pkgs/os-specific/bsd/default.nix
+++ b/pkgs/os-specific/bsd/default.nix
@@ -2,7 +2,4 @@
 
 rec {
   netbsd = recurseIntoAttrs (callPackages ./netbsd {});
-  openbsd = recurseIntoAttrs (callPackages ./openbsd {
-    inherit (netbsd) compat netBSDDerivation libcurses;
-  });
 }
diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix
index 42633232c71a7..ecd09eaff8070 100644
--- a/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/pkgs/os-specific/bsd/netbsd/default.nix
@@ -11,22 +11,15 @@ let
 
   netBSDDerivation = attrs: stdenv.mkDerivation ((rec {
     name = "${attrs.pname or (baseNameOf attrs.path)}-netbsd-${attrs.version}";
-    src = fetchNetBSD attrs.path attrs.version attrs.sha256;
+    src = attrs.src or fetchNetBSD attrs.path attrs.version attrs.sha256;
 
     extraPaths = [ ];
 
-    nativeBuildInputs = [ makeMinimal mandoc groff install yacc flex ];
+    nativeBuildInputs = [ makeMinimal mandoc groff install stat
+                          yacc flex tsort lorder ];
     buildInputs = [ compat ];
     installFlags = [ "includes" ];
 
-    # These should be coverd in nbcompat, but are missing, sadly
-    NIX_CFLAGS_COMPILE = [
-      "-D__noinline="
-      "-D__warn_references(a,b)="
-      "-D__strong_alias(a,b)="
-      "-D__va_list=va_list"
-    ];
-
     # Definitions passed to share/mk/*.mk. Should be pretty simple -
     # eventually maybe move it to a configure script.
     DESTDIR = "$(out)";
@@ -45,8 +38,12 @@ let
     LIBUTIL="";
     LIBSSL = "";
     LIBCRYPTO = "";
+    LIBCRYPT = "";
     LIBCURSES = "";
+    LIBTERMINFO = "";
+    LIBM = "";
     "LIBDO.terminfo" = "_external";
+    "LIBDO.curses" = "_external";
     _GCC_CRTBEGIN = "";
     _GCC_CRTBEGINS = "";
     _GCC_CRTEND = "";
@@ -71,11 +68,10 @@ let
 
     HOST_SH = "${bash}/bin/sh";
 
-    # not using bsd binutils
     SHLIB_WARNTEXTREL = "no";
     SHLIB_MKMAP = "no";
-    OBJCOPY = "true";
     PRESERVE = "-p";
+    OBJCOPY = if stdenv.isDarwin then "true" else "objcopy";
 
     MACHINE_ARCH = hostPlatform.parsed.cpu.name;
     MACHINE_CPU = hostPlatform.parsed.cpu.name;
@@ -84,9 +80,8 @@ let
     # but without they end up using gcc on Darwin stdenv
     preConfigure = ''
       export HAVE_${if stdenv.cc.isGNU then "GCC" else "LLVM"}=${lib.head (lib.splitString "." (lib.getVersion stdenv.cc.cc))}
-    '' + lib.optionalString (!builtins.hasAttr "nativeBuildInputs" attrs) ''
-      # hack until #38657 is fixed
-      export PATH=${install}/bin:$PATH
+      # Parallel building. Needs the space.
+      export makeFlags+=" -j $NIX_BUILD_CORES"
     '';
 
     postUnpack = ''
@@ -109,12 +104,14 @@ let
       fi
     '';
 
-    # need to create directories for xinstall to work
+    # Need to create directories for xinstall to work. Unused ones
+    # will be removed in the postInstall.
     preInstall = ''
       mkdir -p $out$BINDIR $out$LIBDIR $out$INFODIR \
                $out$DOCDIR $out$LOCALEDIR
       for i in 1 2 3 4 5 6 7 8 9; do
-        mkdir -p $out$MANDIR/man$i $out$MANDIR/html$i $out$DOCDIR/reference/ref$i
+        mkdir -p $out$MANDIR/man$i $out$MANDIR/html$i \
+                 $out$DOCDIR/reference/ref$i
       done
       mkdir -p $out/usr/include
     '';
@@ -125,7 +122,6 @@ let
         cd $out/usr
         find . -type d -exec mkdir -p $out/\{} \;
         find . -type f -exec mv \{} $out/\{} \;
-        find . -type d -delete
       fi
 
       find $out -type d -empty -delete
@@ -146,8 +142,6 @@ let
 
     buildInputs = [];
     nativeBuildInputs = [];
-    NIX_CFLAGS_COMPILE = "";
-    NIX_LDFLAGS = "";
 
     patchPhase = ''
       patchShebangs configure
@@ -173,8 +167,6 @@ let
     # override defaults to prevent infinite recursion
     nativeBuildInputs = [ makeMinimal ];
     buildInputs = [ zlib ];
-    NIX_CFLAGS_COMPILE = "";
-    NIX_LDFLAGS = "";
 
     # temporarily use gnuinstall for bootstrapping
     # bsdinstall will be built later
@@ -195,7 +187,22 @@ let
       install -D $NETBSDSRCDIR/sys/sys/rmd160.h $out/include/rmd160.h
       install -D $NETBSDSRCDIR/sys/sys/sha1.h $out/include/sha1.h
       install -D $NETBSDSRCDIR/sys/sys/sha2.h $out/include/sha2.h
+      install -D $NETBSDSRCDIR/sys/sys/queue.h $out/include/sys/queue.h
       install -D $NETBSDSRCDIR/include/vis.h $out/include/vis.h
+      install -D $NETBSDSRCDIR/include/db.h $out/include/db.h
+      install -D $NETBSDSRCDIR/include/netconfig.h $out/include/netconfig.h
+      install -D $NETBSDSRCDIR/include/rpc/types.h $out/include/rpc/types.h
+      install -D $NETBSDSRCDIR/include/utmpx.h $out/include/utmpx.h
+      install -D $NETBSDSRCDIR/include/tzfile.h $out/include/tzfile.h
+
+      # Remove lingering /usr references
+      if [ -d $out/usr ]; then
+        cd $out/usr
+        find . -type d -exec mkdir -p $out/\{} \;
+        find . -type f -exec mv \{} $out/\{} \;
+      fi
+
+      find $out -type d -empty -delete
     '';
     extraPaths = [ libc.src libutil.src
       (fetchNetBSD "include" "7.1.2" "1vc58xrhrp202biiv1chhlh0jwnjr7k3qq91pm46k6v5j95j0qwp")
@@ -209,9 +216,57 @@ let
     version = "7.1.2";
     sha256 = "0nzhyh714m19h61m45gzc5dszkbafp5iaphbp5mza6w020fzf2y8";
     extraPaths = [ mtree.src make.src ];
-    nativeBuildInputs = [ makeMinimal mandoc groff compat ];
+    nativeBuildInputs = [ makeMinimal mandoc groff ];
+    buildInputs = [ compat fts ];
     RENAME = "-D";
   };
+
+  fts = netBSDDerivation {
+    pname = "fts";
+    path = "include/fts.h";
+    sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
+    version = "7.1.2";
+    nativeBuildInputs = [ ];
+    propagatedBuildInputs = [ compat ];
+    extraPaths = [
+      (fetchNetBSD "lib/libc/gen/fts.c" "7.1.2" "1yfd2liypj6xky2h0mgxi5lgpflmkkg4zf3ii3apz5cf8jq9gmn9")
+      (fetchNetBSD "lib/libc/include/namespace.h" "7.1.2" "0kwd4v8y0mfjhmwplsk52pvzbcpvpp2qy2g8c0jmfraam63q6q1y")
+      (fetchNetBSD "lib/libc/gen/fts.3" "7.1.2" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1")
+    ];
+    buildPhase = ''
+      cc  -c -Iinclude -Ilib/libc/include lib/libc/gen/fts.c \
+          -o lib/libc/gen/fts.o
+      ar -rsc libfts.a lib/libc/gen/fts.o
+    '';
+    installPhase = ''
+      install -D lib/libc/gen/fts.3 $out/share/man/man3/fts.3
+      install -D include/fts.h $out/include/fts.h
+      install -D lib/libc/include/namespace.h $out/include/namespace.h
+      install -D libfts.a $out/lib/libfts.a
+    '';
+    setupHook = ./fts-setup-hook.sh;
+  };
+
+  stat = netBSDDerivation {
+    path = "usr.bin/stat";
+    version = "7.1.2";
+    sha256 = "0z4r96id2r4cfy443rw2s1n52n186xm0lqvs8s3qjf4314z7r7yh";
+    nativeBuildInputs = [ makeMinimal mandoc groff install ];
+  };
+
+  tsort = netBSDDerivation {
+    path = "usr.bin/tsort";
+    version = "7.1.2";
+    sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq";
+    nativeBuildInputs = [ makeMinimal mandoc groff install ];
+  };
+
+  lorder = netBSDDerivation {
+    path = "usr.bin/lorder";
+    version = "7.1.2";
+    sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
+    nativeBuildInputs = [ makeMinimal mandoc groff install ];
+  };
   # END BOOTSTRAPPING
 
   libutil = netBSDDerivation {
@@ -238,7 +293,7 @@ let
     version = "7.1.2";
     patchPhase = ''
       # make needs this to pick up our sys make files
-      NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
+      export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
 
       # can't set owner or group in Nix build
       # maybe there is a better way to trick it?
@@ -251,6 +306,9 @@ let
         --replace '-o ''${DEBUGOWN} -g ''${DEBUGGRP}' ""
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.doc.mk \
         --replace '-o ''${DOCOWN} -g ''${DOCGRP}' ""
+      substituteInPlace $NETBSDSRCDIR/share/mk/bsd.links.mk \
+        --replace '-o ''${LINKSOWN_''${.ALLSRC:T}:U''${LINKSOWN}}' "" \
+        --replace '-g ''${LINKSGRP_''${.ALLSRC:T}:U''${LINKSGRP}}' ""
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.man.mk \
         --replace '-o ''${MANOWN} -g ''${MANGRP}' ""
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.files.mk \
@@ -261,13 +319,10 @@ let
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
         --replace '-o ''${DEBUGOWN} -g ''${DEBUGGRP}' "" \
         --replace '-o ''${LIBOWN} -g ''${LIBGRP}' ""
-
-      substituteInPlace $NETBSDSRCDIR/share/mk/Makefile \
-        --replace /usr/share/mk /share/mk
+    '' + lib.optionalString stdenv.isDarwin ''
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \
         --replace '-Wl,--fatal-warnings' ""
       substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
-        --replace ' ''${_ARFL} ''${.TARGET} `NM=''${NM} ''${LORDER} ''${.ALLSRC:M*o} | ''${TSORT}`' ' ''${_ARFL} ''${.TARGET} ''${.ALLSRC:M*o}' \
         --replace '-Wl,-soname,''${_LIB}.so.''${SHLIB_SOVERSION}' "" \
         --replace '-Wl,--whole-archive' "" \
         --replace '-Wl,--no-whole-archive' ""
@@ -286,8 +341,21 @@ let
     sha256 = "1dhsyfvcm67kf5zdbg5dmx5y8fimnbll6qxwp3gjfmbxqigmc52m";
   };
 
+  who = netBSDDerivation {
+    path = "usr.bin/who";
+    version = "7.1.2";
+    sha256 = "17ffwww957m3qw0b6fkgjpp12pd5ydg2hs9dxkkw0qpv11j00d88";
+    patchPhase = ''
+      substituteInPlace $NETBSDSRCDIR/usr.bin/who/utmpentry.c \
+        --replace "strncpy(e->name, up->ut_name, sizeof(up->ut_name))" "strncpy(e->name, up->ut_user, sizeof(up->ut_user))" \
+        --replace "utmptime = st.st_mtimespec" "utmptime = st.st_mtim" \
+        --replace "timespeccmp(&st.st_mtimespec, &utmptime, >)" "st.st_mtim.tv_sec == utmptime.tv_sec ? st.st_mtim.tv_nsec > utmptime.tv_nsec : st.st_mtim.tv_sec > utmptime.tv_sec" \
+        --replace "timespecclear(&utmptime)" "utmptime.tv_sec = utmptime.tv_nsec = 0"
+    '';
+  };
+
 in rec {
-  inherit compat libc libutil install make mtree netBSDDerivation;
+  inherit compat install netBSDDerivation fts;
 
   getent = netBSDDerivation {
     path = "usr.bin/getent";
@@ -302,65 +370,103 @@ in rec {
     version = "7.1.2";
   };
 
-  fts = netBSDDerivation {
-    pname = "fts";
-    path = "include/fts.h";
-    sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
-    version = "7.1.2";
-    nativeBuildInputs = [ ];
-    extraPaths = [
-      (fetchNetBSD "lib/libc/gen/fts.c" "7.1.2" "1yfd2liypj6xky2h0mgxi5lgpflmkkg4zf3ii3apz5cf8jq9gmn9")
-      (fetchNetBSD "lib/libc/include/namespace.h" "7.1.2" "0kwd4v8y0mfjhmwplsk52pvzbcpvpp2qy2g8c0jmfraam63q6q1y")
-      (fetchNetBSD "lib/libc/gen/fts.3" "7.1.2" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1")
-    ];
-    buildPhase = ''
-      cc  -c -Iinclude -Ilib/libc/include lib/libc/gen/fts.c \
-          -o lib/libc/gen/fts.o
-      ar -rsc libfts.a lib/libc/gen/fts.o
-    '';
-    installPhase = ''
-      install -D lib/libc/gen/fts.3 $out/share/man/man3/fts.3
-      install -D include/fts.h $out/include/fts.h
-      install -D lib/libc/include/namespace.h $out/include/namespace.h
-      install -D libfts.a $out/lib/libfts.a
-    '';
-    setupHook = ./fts-setup-hook.sh;
-  };
-
   games = netBSDDerivation {
     path = "games";
     sha256 = "04wjsang8f8kxsifiayklbxaaxmm3vx9rfr91hfbxj4hk8gkqzy1";
     version = "7.1.2";
     patchPhase = ''
       sed -i '1i #include <time.h>' adventure/save.c
-    '';
-  };
 
-  who = netBSDDerivation {
-    path = "usr.bin/who";
-    version = "7.1.2";
-    sha256 = "17ffwww957m3qw0b6fkgjpp12pd5ydg2hs9dxkkw0qpv11j00d88";
+      # Disable some games that don't build. They should be possible
+      # to build but need to look at how to implement stuff in
+      # Linux. macOS is missing gettime. TODO try to get these
+      # working.
+      disableGame() {
+        substituteInPlace Makefile --replace $1 ""
+      }
+
+      disableGame atc
+      disableGame boggle
+      disableGame dm
+      disableGame fortune
+      disableGame hunt
+      disableGame larn
+      disableGame phantasia
+      disableGame rogue
+      disableGame sail
+      disableGame trek
+      disableGame dab
+      ${lib.optionalString stdenv.isDarwin "disableGame adventure"}
+      ${lib.optionalString stdenv.isDarwin "disableGame factor"}
+      ${lib.optionalString stdenv.isDarwin "disableGame gomoku"}
+      ${lib.optionalString stdenv.isDarwin "disableGame mille"}
+
+      substituteInPlace Makefile.inc \
+        --replace 2555 555 \
+        --replace 2550 550
+    '';
+    NIX_CFLAGS_COMPILE = [
+      "-D__noinline="
+      "-D__scanflike(a,b)="
+      "-D__va_list=va_list"
+      "-DOXTABS=XTABS"
+      "-DRANDOM_MAX=RAND_MAX"
+      "-DINFTIM=-1"
+      (if hostPlatform.isMusl then "-include sys/ttydefaults.h -include sys/file.h" else "")
+    ];
+    postBuild = ''
+      mkdir -p $out/usr/games $out/usr/share/games/ching \
+               $out/usr/share/games/quiz.db \
+               $out/usr/libexec/ching $out/var/games/hackdir
+      touch $out/var/games/hackdir/perm
+    '';
+    preFixup = ''
+      mkdir -p $out/bin
+      mv $out/games/* $out/bin
+      rmdir $out/games
+    '';
+    buildInputs = [ compat libcurses libterminfo libressl ];
+    extraPaths = [
+      (fetchNetBSD "share/dict" "7.1.2" "0nickhsjwgnr2h9nvwflvgfz93kqms5hzdnpyq02crpj35w98bh4")
+      who.src
+    ];
   };
 
-  finger = netBSDDerivation {
-    path = "usr.bin/finger";
-    sha256 = "0jl672z50f2yf7ikp682b3xrarm6bnrrx9vi94xnp2fav8m8zfyi";
-    version = "7.1.2";
-    extraPaths = [ who.src ];
-  };
+  # finger = netBSDDerivation {
+  #   path = "usr.bin/finger";
+  #   sha256 = "0jl672z50f2yf7ikp682b3xrarm6bnrrx9vi94xnp2fav8m8zfyi";
+  #   version = "7.1.2";
+  #   extraPaths = [ who.src ];
+  #   NIX_CFLAGS_COMPILE = [
+  #     "-DSUPPORT_UTMP"
+  #     "-USUPPORT_UTMPX"
+  #   ];
+  #   patchPhase = ''
+  #     ${who.patchPhase}
+  #   '';
+  # };
 
   fingerd = netBSDDerivation {
-    path = "usr.bin/fingerd";
-    sha256 = "04wjsang8f8kxsifiayklbxaaxmm3vx9rfr91hfbxj4hk8gkqz00";
+    path = "libexec/fingerd";
+    sha256 = "1hhdq70hrxxkjnjfmjm3w8w9g9xq2ngxaxk0chy4vm7chg9nfpmp";
     version = "7.1.2";
   };
 
   libedit = netBSDDerivation {
     path = "lib/libedit";
-    buildInputs = [ compat libterminfo ];
+    buildInputs = [ libterminfo libcurses ];
+    propagatedBuildInputs = [ compat ];
+    postBuild = "mkdir -p $out/usr/include/readline";
     patchPhase = ''
       sed -i '1i #undef bool_t' el.h
+      substituteInPlace config.h \
+        --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" ""
     '';
+    NIX_CFLAGS_COMPILE = [
+      "-D__noinline="
+      "-D__scanflike(a,b)="
+      "-D__va_list=va_list"
+    ];
     version = "7.1.2";
     sha256 = "0qvr52j4qih10m7fa8nddn1psyjy9l0pa4ix02acyssjvgbz2kca";
   };
@@ -370,6 +476,7 @@ in rec {
     version = "7.1.2";
     sha256 = "06plg0bjqgbb0aghpb9qlk8wkp1l2izdlr64vbr5laqyw8jg84zq";
     buildInputs = [ compat tic nbperf ];
+    MKPIC = if stdenv.isDarwin then "no" else "yes";
     extraPaths = [
       (fetchNetBSD "share/terminfo" "7.1.2" "1z5vzq8cw24j05r6df4vd6r57cvdbv7vbm4h962kplp14xrbg2h3")
     ];
@@ -379,8 +486,22 @@ in rec {
     path = "lib/libcurses";
     version = "7.1.2";
     sha256 = "04djah9dadzw74nswn0xydkxn900kav8xdvxlxdl50nbrynxg9yf";
-    buildInputs = [ compat libterminfo ];
+    buildInputs = [ libterminfo ];
+    NIX_CFLAGS_COMPILE = [
+      "-D__scanflike(a,b)="
+      "-D__va_list=va_list"
+      "-D__warn_references(a,b)="
+    ] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)=";
+    propagatedBuildInputs = [ compat ];
     MKDOC = "no"; # missing vfontedpr
+    MKPIC = if stdenv.isDarwin then "no" else "yes";
+    patchPhase = lib.optionalString (!stdenv.isDarwin) ''
+      substituteInPlace printw.c \
+        --replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \
+        --replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));'
+      substituteInPlace scanw.c \
+        --replace "__strong_alias(vwscanw, vw_scanw)" 'extern int vwscanw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_scanw")));'
+    '';
   };
 
   nbperf = netBSDDerivation {
diff --git a/pkgs/os-specific/bsd/openbsd/default.nix b/pkgs/os-specific/bsd/openbsd/default.nix
deleted file mode 100644
index 9ccc0adaa2df2..0000000000000
--- a/pkgs/os-specific/bsd/openbsd/default.nix
+++ /dev/null
@@ -1,42 +0,0 @@
-{ fetchcvs, netBSDDerivation, compat, libcurses, libressl }:
-
-let
-  fetchOpenBSD = path: version: sha256: fetchcvs {
-    cvsRoot = "anoncvs@anoncvs.ca.openbsd.org:/cvs";
-    module = "src/${path}";
-    inherit sha256;
-    tag = "OPENBSD_${builtins.replaceStrings ["."] ["_"] version}";
-  };
-
-  # OpenBSD is a fork of NetBSD
-  # We can build it with minimal changes
-  openBSDDerivation = attrs: netBSDDerivation (attrs // {
-    name = "${attrs.pname or (baseNameOf attrs.path)}-openbsd-${attrs.version}";
-    src = fetchOpenBSD attrs.path attrs.version attrs.sha256;
-  });
-
-in {
-
-  mg = openBSDDerivation {
-    path = "usr.bin/mg";
-    version = "6.3";
-    sha256 = "0n3hwa81c2mcjwbmidrbvi1l25jh8hy939kqrigbv78jixpynffc";
-    buildInputs = [ compat libcurses ];
-    patchPhase = ''
-      NIX_CFLAGS_COMPILE+=" -I$BSDSRCDIR/sys"
-    '';
-    extraPaths = [
-      (fetchOpenBSD "sys/sys/tree.h" "6.3" "0rimh41wn9wz5m510zk9i27z3s450qqgq2k5xn8kp3885hygbcj9")
-      (fetchOpenBSD "sys/sys/_null.h" "6.3" "0l2rgg9ai4ivfl07zmbqli19vnm3lj7qkxpikqplmzrfp36qpzgr")
-    ];
-  };
-
-  nc = openBSDDerivation {
-    path = "usr.bin/nc";
-    version = "6.3";
-    sha256 = "0fmnh6ccxab0qvhmgspyd3wra1ps2516i0j6hwkvna2lcny20xvr";
-    patches = [ ./nc.patch ];
-    buildInputs = [ compat libressl ];
-  };
-
-}
diff --git a/pkgs/os-specific/bsd/openbsd/nc.patch b/pkgs/os-specific/bsd/openbsd/nc.patch
deleted file mode 100644
index de6fb2d04c41c..0000000000000
--- a/pkgs/os-specific/bsd/openbsd/nc.patch
+++ /dev/null
@@ -1,421 +0,0 @@
---- a/nc.1
-+++ b/nc.1
-@@ -204,9 +204,6 @@ Proxy authentication is only supported f
- Specifies the source port
- .Nm
- should use, subject to privilege restrictions and availability.
--It is an error to use this option in conjunction with the
--.Fl l
--option.
- .It Fl R Ar CAfile
- Specifies the filename from which the root CA bundle for certificate
- verification is loaded, in PEM format.
-@@ -258,6 +255,7 @@ For IPv4 TOS value
- may be one of
- .Ar critical ,
- .Ar inetcontrol ,
-+.Ar lowcost ,
- .Ar lowdelay ,
- .Ar netcontrol ,
- .Ar throughput ,
---- a/netcat.c
-+++ b/netcat.c
-@@ -32,6 +32,8 @@
-  * *Hobbit* <hobbit@avian.org>.
-  */
- 
-+#define _GNU_SOURCE
-+
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <sys/uio.h>
-@@ -41,6 +43,49 @@
- #include <netinet/tcp.h>
- #include <netinet/ip.h>
- #include <arpa/telnet.h>
-+#ifdef __linux__
-+# include <linux/in6.h>
-+#endif
-+
-+#ifndef IPTOS_LOWDELAY
-+# define IPTOS_LOWDELAY 0x10
-+# define IPTOS_THROUGHPUT 0x08
-+# define IPTOS_RELIABILITY 0x04
-+# define IPTOS_LOWCOST 0x02
-+# define IPTOS_MINCOST IPTOS_LOWCOST
-+#endif /* IPTOS_LOWDELAY */
-+
-+# ifndef IPTOS_DSCP_AF11
-+# define	IPTOS_DSCP_AF11		0x28
-+# define	IPTOS_DSCP_AF12		0x30
-+# define	IPTOS_DSCP_AF13		0x38
-+# define	IPTOS_DSCP_AF21		0x48
-+# define	IPTOS_DSCP_AF22		0x50
-+# define	IPTOS_DSCP_AF23		0x58
-+# define	IPTOS_DSCP_AF31		0x68
-+# define	IPTOS_DSCP_AF32		0x70
-+# define	IPTOS_DSCP_AF33		0x78
-+# define	IPTOS_DSCP_AF41		0x88
-+# define	IPTOS_DSCP_AF42		0x90
-+# define	IPTOS_DSCP_AF43		0x98
-+# define	IPTOS_DSCP_EF		0xb8
-+#endif /* IPTOS_DSCP_AF11 */
-+
-+#ifndef IPTOS_DSCP_CS0
-+# define	IPTOS_DSCP_CS0		0x00
-+# define	IPTOS_DSCP_CS1		0x20
-+# define	IPTOS_DSCP_CS2		0x40
-+# define	IPTOS_DSCP_CS3		0x60
-+# define	IPTOS_DSCP_CS4		0x80
-+# define	IPTOS_DSCP_CS5		0xa0
-+# define	IPTOS_DSCP_CS6		0xc0
-+# define	IPTOS_DSCP_CS7		0xe0
-+#endif /* IPTOS_DSCP_CS0 */
-+
-+#ifndef IPTOS_DSCP_EF
-+# define	IPTOS_DSCP_EF		0xb8
-+#endif /* IPTOS_DSCP_EF */
-+
- 
- #include <err.h>
- #include <errno.h>
-@@ -268,10 +315,14 @@ main(int argc, char *argv[])
- 			uflag = 1;
- 			break;
- 		case 'V':
-+# if defined(RT_TABLEID_MAX)
- 			rtableid = (int)strtonum(optarg, 0,
- 			    RT_TABLEID_MAX, &errstr);
- 			if (errstr)
- 				errx(1, "rtable %s: %s", errstr, optarg);
-+# else
-+			errx(1, "no alternate routing table support available");
-+# endif
- 			break;
- 		case 'v':
- 			vflag = 1;
-@@ -320,7 +371,11 @@ main(int argc, char *argv[])
- 			oflag = optarg;
- 			break;
- 		case 'S':
-+# if defined(TCP_MD5SIG)
- 			Sflag = 1;
-+# else
-+			errx(1, "no TCP MD5 signature support available");
-+# endif
- 			break;
- 		case 'T':
- 			errstr = NULL;
-@@ -345,35 +400,23 @@ main(int argc, char *argv[])
- 	argc -= optind;
- 	argv += optind;
- 
-+# if defined(RT_TABLEID_MAX)
- 	if (rtableid >= 0)
- 		if (setrtable(rtableid) == -1)
- 			err(1, "setrtable");
--
--	if (family == AF_UNIX) {
--		if (pledge("stdio rpath wpath cpath tmppath unix", NULL) == -1)
--			err(1, "pledge");
--	} else if (Fflag && Pflag) {
--		if (pledge("stdio inet dns sendfd tty", NULL) == -1)
--			err(1, "pledge");
--	} else if (Fflag) { 
--		if (pledge("stdio inet dns sendfd", NULL) == -1)
--			err(1, "pledge");
--	} else if (Pflag && usetls) {
--		if (pledge("stdio rpath inet dns tty", NULL) == -1)
--			err(1, "pledge");
--	} else if (Pflag) {
--		if (pledge("stdio inet dns tty", NULL) == -1)
--			err(1, "pledge");
--	} else if (usetls) {
--		if (pledge("stdio rpath inet dns", NULL) == -1)
--			err(1, "pledge");
--	} else if (pledge("stdio inet dns", NULL) == -1)
--		err(1, "pledge");
-+# endif
- 
- 	/* Cruft to make sure options are clean, and used properly. */
- 	if (argv[0] && !argv[1] && family == AF_UNIX) {
- 		host = argv[0];
- 		uport = NULL;
-+	} else if (!argv[0] && lflag) {
-+		if (sflag)
-+			errx(1, "cannot use -s and -l");
-+		if (pflag)
-+			errx(1, "cannot use -p and -l");
-+		if (zflag)
-+			errx(1, "cannot use -z and -l");
- 	} else if (argv[0] && !argv[1]) {
- 		if (!lflag)
- 			usage(1);
-@@ -385,12 +428,6 @@ main(int argc, char *argv[])
- 	} else
- 		usage(1);
- 
--	if (lflag && sflag)
--		errx(1, "cannot use -s and -l");
--	if (lflag && pflag)
--		errx(1, "cannot use -p and -l");
--	if (lflag && zflag)
--		errx(1, "cannot use -z and -l");
- 	if (!lflag && kflag)
- 		errx(1, "must use -l with -k");
- 	if (uflag && usetls)
-@@ -425,8 +462,8 @@ main(int argc, char *argv[])
- 		} else {
- 			strlcpy(unix_dg_tmp_socket_buf, "/tmp/nc.XXXXXXXXXX",
- 			    UNIX_DG_TMP_SOCKET_SIZE);
--			if (mktemp(unix_dg_tmp_socket_buf) == NULL)
--				err(1, "mktemp");
-+			if (mkstemp(unix_dg_tmp_socket_buf) == -1)
-+				err(1, "mkstemp");
- 			unix_dg_tmp_socket = unix_dg_tmp_socket_buf;
- 		}
- 	}
-@@ -901,8 +938,10 @@ remote_connect(const char *host, const c
- 		if (sflag || pflag) {
- 			struct addrinfo ahints, *ares;
- 
-+# if defined (SO_BINDANY)
- 			/* try SO_BINDANY, but don't insist */
- 			setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on));
-+# endif
- 			memset(&ahints, 0, sizeof(struct addrinfo));
- 			ahints.ai_family = res->ai_family;
- 			ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM;
-@@ -994,9 +1033,15 @@ local_listen(char *host, char *port, str
- 		    res->ai_protocol)) < 0)
- 			continue;
- 
-+		ret = setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
-+		if (ret == -1)
-+			err(1, NULL);
-+
-+# if defined(SO_REUSEPORT)
- 		ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
- 		if (ret == -1)
- 			err(1, NULL);
-+# endif
- 
- 		set_common_sockopts(s, res->ai_family);
- 
-@@ -1452,11 +1497,13 @@ set_common_sockopts(int s, int af)
- {
- 	int x = 1;
- 
-+# if defined(TCP_MD5SIG)
- 	if (Sflag) {
- 		if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
- 			&x, sizeof(x)) == -1)
- 			err(1, NULL);
- 	}
-+# endif
- 	if (Dflag) {
- 		if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
- 			&x, sizeof(x)) == -1)
-@@ -1467,9 +1514,14 @@ set_common_sockopts(int s, int af)
- 		    IP_TOS, &Tflag, sizeof(Tflag)) == -1)
- 			err(1, "set IP ToS");
- 
-+#if defined(IPV6_TCLASS)
- 		else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
- 		    IPV6_TCLASS, &Tflag, sizeof(Tflag)) == -1)
- 			err(1, "set IPv6 traffic class");
-+#else
-+		else if (af == AF_INET6)
-+			errx(1, "can't set IPv6 traffic class (unavailable)");
-+#endif
- 	}
- 	if (Iflag) {
- 		if (setsockopt(s, SOL_SOCKET, SO_RCVBUF,
-@@ -1487,19 +1539,34 @@ set_common_sockopts(int s, int af)
- 		    IP_TTL, &ttl, sizeof(ttl)))
- 			err(1, "set IP TTL");
- 
-+#if defined(IPV6_UNICAST_HOPS)
- 		else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
- 		    IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)))
- 			err(1, "set IPv6 unicast hops");
-+#else
-+		else if (af == AF_INET6)
-+			errx(1, "can't set IPv6 unicast hops (unavailable)");
-+#endif
- 	}
- 
- 	if (minttl != -1) {
-+#if defined(IP_MINTTL)
- 		if (af == AF_INET && setsockopt(s, IPPROTO_IP,
- 		    IP_MINTTL, &minttl, sizeof(minttl)))
- 			err(1, "set IP min TTL");
-+#else
-+		if (af == AF_INET)
-+			errx(1, "can't set IP min TTL (unavailable)");
-+#endif
- 
-+#if defined(IPV6_MINHOPCOUNT)
- 		else if (af == AF_INET6 && setsockopt(s, IPPROTO_IPV6,
- 		    IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)))
- 			err(1, "set IPv6 min hop count");
-+#else
-+		else if (af == AF_INET6)
-+			errx(1, "can't set IPv6 min hop count (unavailable)");
-+#endif
- 	}
- }
- 
-@@ -1534,6 +1601,7 @@ process_tos_opt(char *s, int *val)
- 		{ "cs7",		IPTOS_DSCP_CS7 },
- 		{ "ef",			IPTOS_DSCP_EF },
- 		{ "inetcontrol",	IPTOS_PREC_INTERNETCONTROL },
-+		{ "lowcost",		IPTOS_LOWCOST },
- 		{ "lowdelay",		IPTOS_LOWDELAY },
- 		{ "netcontrol",		IPTOS_PREC_NETCONTROL },
- 		{ "reliability",	IPTOS_RELIABILITY },
-@@ -1741,7 +1812,7 @@ help(void)
- 	\t-Z		Peer certificate file\n\
- 	\t-z		Zero-I/O mode [used for scanning]\n\
- 	Port numbers can be individual or ranges: lo-hi [inclusive]\n");
--	exit(1);
-+	exit(0);
- }
- 
- void
---- a/socks.c
-+++ b/socks.c
-@@ -219,11 +219,11 @@ socks_connect(const char *host, const ch
- 		buf[2] = SOCKS_NOAUTH;
- 		cnt = atomicio(vwrite, proxyfd, buf, 3);
- 		if (cnt != 3)
--			err(1, "write failed (%zu/3)", cnt);
-+			err(1, "write failed (%zu/3)", (size_t)cnt);
- 
- 		cnt = atomicio(read, proxyfd, buf, 2);
- 		if (cnt != 2)
--			err(1, "read failed (%zu/3)", cnt);
-+			err(1, "read failed (%zu/3)", (size_t)cnt);
- 
- 		if (buf[1] == SOCKS_NOMETHOD)
- 			errx(1, "authentication method negotiation failed");
-@@ -272,11 +272,11 @@ socks_connect(const char *host, const ch
- 
- 		cnt = atomicio(vwrite, proxyfd, buf, wlen);
- 		if (cnt != wlen)
--			err(1, "write failed (%zu/%zu)", cnt, wlen);
-+			err(1, "write failed (%zu/%zu)", (size_t)cnt, (size_t)wlen);
- 
- 		cnt = atomicio(read, proxyfd, buf, 4);
- 		if (cnt != 4)
--			err(1, "read failed (%zu/4)", cnt);
-+			err(1, "read failed (%zu/4)", (size_t)cnt);
- 		if (buf[1] != 0) {
- 			errx(1, "connection failed, SOCKSv5 error: %s",
- 			    socks5_strerror(buf[1]));
-@@ -285,12 +285,12 @@ socks_connect(const char *host, const ch
- 		case SOCKS_IPV4:
- 			cnt = atomicio(read, proxyfd, buf + 4, 6);
- 			if (cnt != 6)
--				err(1, "read failed (%zu/6)", cnt);
-+				err(1, "read failed (%zu/6)", (size_t)cnt);
- 			break;
- 		case SOCKS_IPV6:
- 			cnt = atomicio(read, proxyfd, buf + 4, 18);
- 			if (cnt != 18)
--				err(1, "read failed (%zu/18)", cnt);
-+				err(1, "read failed (%zu/18)", (size_t)cnt);
- 			break;
- 		default:
- 			errx(1, "connection failed, unsupported address type");
-@@ -310,11 +310,11 @@ socks_connect(const char *host, const ch
- 
- 		cnt = atomicio(vwrite, proxyfd, buf, wlen);
- 		if (cnt != wlen)
--			err(1, "write failed (%zu/%zu)", cnt, wlen);
-+			err(1, "write failed (%zu/%zu)", (size_t)cnt, (size_t)wlen);
- 
- 		cnt = atomicio(read, proxyfd, buf, 8);
- 		if (cnt != 8)
--			err(1, "read failed (%zu/8)", cnt);
-+			err(1, "read failed (%zu/8)", (size_t)cnt);
- 		if (buf[1] != 90) {
- 			errx(1, "connection failed, SOCKSv4 error: %s",
- 			    socks4_strerror(buf[1]));
-@@ -328,39 +328,39 @@ socks_connect(const char *host, const ch
- 
- 		/* Try to be sane about numeric IPv6 addresses */
- 		if (strchr(host, ':') != NULL) {
--			r = snprintf(buf, sizeof(buf),
-+			r = snprintf((char*)buf, sizeof(buf),
- 			    "CONNECT [%s]:%d HTTP/1.0\r\n",
- 			    host, ntohs(serverport));
- 		} else {
--			r = snprintf(buf, sizeof(buf),
-+			r = snprintf((char*)buf, sizeof(buf),
- 			    "CONNECT %s:%d HTTP/1.0\r\n",
- 			    host, ntohs(serverport));
- 		}
- 		if (r == -1 || (size_t)r >= sizeof(buf))
- 			errx(1, "hostname too long");
--		r = strlen(buf);
-+		r = strlen((char*)buf);
- 
- 		cnt = atomicio(vwrite, proxyfd, buf, r);
- 		if (cnt != r)
--			err(1, "write failed (%zu/%d)", cnt, r);
-+			err(1, "write failed (%zu/%d)", (size_t)cnt, (int)r);
- 
- 		if (authretry > 1) {
- 			char resp[1024];
- 
- 			proxypass = getproxypass(proxyuser, proxyhost);
--			r = snprintf(buf, sizeof(buf), "%s:%s",
-+			r = snprintf((char*)buf, sizeof(buf), "%s:%s",
- 			    proxyuser, proxypass);
- 			if (r == -1 || (size_t)r >= sizeof(buf) ||
--			    b64_ntop(buf, strlen(buf), resp,
-+			    b64_ntop(buf, strlen((char*)buf), resp,
- 			    sizeof(resp)) == -1)
- 				errx(1, "Proxy username/password too long");
--			r = snprintf(buf, sizeof(buf), "Proxy-Authorization: "
-+			r = snprintf((char*)buf, sizeof(buf), "Proxy-Authorization: "
- 			    "Basic %s\r\n", resp);
- 			if (r == -1 || (size_t)r >= sizeof(buf))
- 				errx(1, "Proxy auth response too long");
--			r = strlen(buf);
-+			r = strlen((char*)buf);
- 			if ((cnt = atomicio(vwrite, proxyfd, buf, r)) != r)
--				err(1, "write failed (%zu/%d)", cnt, r);
-+				err(1, "write failed (%zu/%d)", (size_t)cnt, r);
- 		}
- 
- 		/* Terminate headers */
-@@ -368,22 +368,22 @@ socks_connect(const char *host, const ch
- 			err(1, "write failed (%zu/2)", cnt);
- 
- 		/* Read status reply */
--		proxy_read_line(proxyfd, buf, sizeof(buf));
-+		proxy_read_line(proxyfd, (char*)buf, sizeof(buf));
- 		if (proxyuser != NULL &&
--		    strncmp(buf, "HTTP/1.0 407 ", 12) == 0) {
-+		    strncmp((char*)buf, "HTTP/1.0 407 ", 12) == 0) {
- 			if (authretry > 1) {
- 				fprintf(stderr, "Proxy authentication "
- 				    "failed\n");
- 			}
- 			close(proxyfd);
- 			goto again;
--		} else if (strncmp(buf, "HTTP/1.0 200 ", 12) != 0 &&
--		    strncmp(buf, "HTTP/1.1 200 ", 12) != 0)
-+		} else if (strncmp((char*)buf, "HTTP/1.0 200 ", 12) != 0 &&
-+		    strncmp((char*)buf, "HTTP/1.1 200 ", 12) != 0)
- 			errx(1, "Proxy error: \"%s\"", buf);
- 
- 		/* Headers continue until we hit an empty line */
- 		for (r = 0; r < HTTP_MAXHDRS; r++) {
--			proxy_read_line(proxyfd, buf, sizeof(buf));
-+			proxy_read_line(proxyfd, (char*)buf, sizeof(buf));
- 			if (*buf == '\0')
- 				break;
- 		}
\ No newline at end of file
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d4d1ed8d89a1c..b44eb8b6eb9e5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -21387,5 +21387,5 @@ with pkgs;
                       mount wall hostname more sysctl;
 
   inherit (recurseIntoAttrs (callPackages ../os-specific/bsd { }))
-          netbsd openbsd;
+          netbsd;
 }