about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/hash-slinger/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/hash-slinger/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/hash-slinger/default.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/hash-slinger/default.nix b/nixpkgs/pkgs/tools/security/hash-slinger/default.nix
new file mode 100644
index 000000000000..e51d93e9d7fa
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/hash-slinger/default.nix
@@ -0,0 +1,63 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, python3
+, unbound
+, libreswan
+}:
+
+stdenv.mkDerivation rec {
+  pname = "hash-slinger";
+  version = "3.1";
+
+  src = fetchFromGitHub {
+    owner = "letoams";
+    repo = pname;
+    rev = version;
+    sha256 = "sha256-mhMUdZt846QjwRIh2m/4EE+93fUcCKc2FFeoFpzKYvk=";
+  };
+
+  pythonPath = with python3.pkgs; [
+    dnspython
+    m2crypto
+    python-gnupg
+    pyunbound
+  ];
+
+  buildInputs = [
+    python3.pkgs.wrapPython
+  ];
+
+  propagatedBuildInputs = [
+    unbound
+    libreswan
+  ] ++ pythonPath;
+
+  propagatedUserEnvPkgs = [
+    unbound
+    libreswan
+  ];
+
+  postPatch = ''
+    substituteInPlace Makefile \
+      --replace "$(DESTDIR)/usr" "$out"
+    substituteInPlace ipseckey \
+      --replace "/usr/sbin/ipsec" "${libreswan}/sbin/ipsec"
+    substituteInPlace tlsa \
+      --replace "/var/lib/unbound/root" "${python3.pkgs.pyunbound}/etc/pyunbound/root"
+    patchShebangs *
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin $out/man $out/lib/${python3.libPrefix}/site-packages
+    make install
+    wrapPythonPrograms
+  '';
+
+  meta = with lib; {
+    description = "Various tools to generate special DNS records";
+    homepage = "https://github.com/letoams/hash-slinger";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ leenaars ];
+  };
+}