summary refs log tree commit diff
path: root/pkgs/tools/networking/netcat-openbsd
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-05-07 16:45:41 +0300
committerArtturin <Artturin@artturin.com>2022-05-07 17:10:22 +0300
commit165d8e6db51dc8b5699f5d43263e174af876d930 (patch)
treef2d8f3c24d94c60bf9a35549947f8a0451871f3a /pkgs/tools/networking/netcat-openbsd
parentcce50c11ef0543d6cac071300d56490581db57e4 (diff)
netcat-openbsd: init at 1.218-5
Diffstat (limited to 'pkgs/tools/networking/netcat-openbsd')
-rw-r--r--pkgs/tools/networking/netcat-openbsd/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/pkgs/tools/networking/netcat-openbsd/default.nix b/pkgs/tools/networking/netcat-openbsd/default.nix
new file mode 100644
index 0000000000000..67d458dad1bdd
--- /dev/null
+++ b/pkgs/tools/networking/netcat-openbsd/default.nix
@@ -0,0 +1,54 @@
+{ lib, stdenv, fetchFromGitLab, pkg-config, libbsd, installShellFiles }:
+
+stdenv.mkDerivation rec {
+  pname = "netcat-openbsd";
+  version = "1.218-5";
+
+  src = fetchFromGitLab {
+    domain = "salsa.debian.org";
+    owner = "debian";
+    repo = "netcat-openbsd";
+    rev = "refs/tags/debian/${version}";
+    sha256 = "sha256-jEJ8x49Z1UN2qOChGp173aQuPkgl2fWwUUJgUdOv60I=";
+  };
+
+  strictDeps = true;
+  nativeBuildInputs = [ pkg-config installShellFiles ];
+  buildInputs = [ libbsd ];
+
+  NIX_CFLAGS_COMPILE = [
+    "-I${lib.getDev libbsd}/include/libbsd"
+  ];
+
+  NIX_LDFLAGS = [ "-lbsd" ];
+
+  postPatch = ''
+    for file in $(cat debian/patches/series); do
+      patch -p1 < debian/patches/$file
+    done
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/bin
+    mv nc $out/bin/nc
+    installManPage nc.1
+
+    runHook postInstall
+  '';
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    $out/bin/nc -h 2> /dev/null
+  '';
+
+  meta = with lib; {
+    description = "TCP/IP swiss army knife. OpenBSD variant";
+    homepage = "https://salsa.debian.org/debian/netcat-openbsd";
+    maintainers = with maintainers; [ artturin ];
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    mainProgram = "nc";
+  };
+}