summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorFrederik Rietdijk <freddyrietdijk@fridh.nl>2016-08-01 09:57:12 +0200
committerGitHub <noreply@github.com>2016-08-01 09:57:12 +0200
commit8f9326ffd8a75b0b807d62723f895e38b2e663bd (patch)
tree03bc67cecfdd425ce436c10d41afed4662dab14e /pkgs/tools
parentdbd856d7240b992fc45aedf6e2227f4028b72a5b (diff)
parentc8f2d8dae0f3a7511c708e4896502654361f4a67 (diff)
downloadnixlib-8f9326ffd8a75b0b807d62723f895e38b2e663bd.tar
nixlib-8f9326ffd8a75b0b807d62723f895e38b2e663bd.tar.gz
nixlib-8f9326ffd8a75b0b807d62723f895e38b2e663bd.tar.bz2
nixlib-8f9326ffd8a75b0b807d62723f895e38b2e663bd.tar.lz
nixlib-8f9326ffd8a75b0b807d62723f895e38b2e663bd.tar.xz
nixlib-8f9326ffd8a75b0b807d62723f895e38b2e663bd.tar.zst
nixlib-8f9326ffd8a75b0b807d62723f895e38b2e663bd.zip
Merge pull request #17323 from arpa2/hashslinger
Hash-slinger: init at  2.7.0
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/networking/unbound/python.nix63
-rw-r--r--pkgs/tools/security/hash-slinger/default.nix44
2 files changed, 107 insertions, 0 deletions
diff --git a/pkgs/tools/networking/unbound/python.nix b/pkgs/tools/networking/unbound/python.nix
new file mode 100644
index 000000000000..b2f43740a677
--- /dev/null
+++ b/pkgs/tools/networking/unbound/python.nix
@@ -0,0 +1,63 @@
+{ stdenv, fetchurl, openssl, expat, libevent, swig, python, pythonPackages }:
+
+stdenv.mkDerivation rec {
+  pname = "pyunbound";
+  name = "${pname}-${version}";
+  version = "1.5.9";
+
+  src = fetchurl {
+    url = "http://unbound.net/downloads/unbound-${version}.tar.gz";
+    sha256 = "01328cfac99ab5b8c47115151896a244979e442e284eb962c0ea84b7782b6990";
+  };
+
+  buildInputs = [ openssl expat libevent swig python ];
+
+  patchPhase = ''substituteInPlace Makefile.in \
+    --replace "\$(DESTDIR)\$(PYTHON_SITE_PKG)" "$out/${python.sitePackages}" \
+    --replace "\$(LIBTOOL) --mode=install cp _unbound.la" "cp _unbound.la"
+    '';
+
+  preConfigure = "export PYTHON_VERSION=${python.majorVersion}";
+
+  configureFlags = [
+    "--with-ssl=${openssl.dev}"
+    "--with-libexpat=${expat.dev}"
+    "--with-libevent=${libevent.dev}"
+    "--localstatedir=/var"
+    "--sysconfdir=/etc"
+    "--sbindir=\${out}/bin"
+    "--enable-pie"
+    "--enable-relro-now"
+    "--with-pyunbound"
+    "DESTDIR=$out PREFIX="
+  ];
+
+  preInstall = ''
+    mkdir -p $out/${python.sitePackages} $out/etc/${pname}
+    cp .libs/_unbound.so .libs/libunbound.so* $out/${python.sitePackages}
+    substituteInPlace _unbound.la \
+      --replace "-L.libs $PWD/libunbound.la" "-L$out/${python.sitePackages}" \
+      --replace "libdir=\'$PWD/${python.sitePackages}\'" "libdir=\'$out/${python.sitePackages}\'"
+    '';
+
+  installFlags = [ "configfile=\${out}/etc/unbound/unbound.conf pyunbound-install lib" ];
+
+  # All we want is the Unbound Python module
+  postInstall = ''
+    # Generate the built in root anchor and root key and store these in a logical place 
+    # to be used by tools depending only on the Python module
+    $out/bin/unbound-anchor -l | head -1 > $out/etc/${pname}/root.anchor
+    $out/bin/unbound-anchor -l | tail --lines=+2 - > $out/etc/${pname}/root.key
+    # We don't need anything else
+    rm -fR $out/bin $out/share $out/include $out/etc/unbound
+    patchelf --replace-needed libunbound.so.2 $out/${python.sitePackages}/libunbound.so.2 $out/${python.sitePackages}/_unbound.so 
+    '';
+
+  meta = with stdenv.lib; {
+    description = "Python library for Unbound, the validating, recursive, and caching DNS resolver";
+    license = licenses.bsd3;
+    homepage = http://www.unbound.net;
+    maintainers = with maintainers; [ leenaars ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/pkgs/tools/security/hash-slinger/default.nix b/pkgs/tools/security/hash-slinger/default.nix
new file mode 100644
index 000000000000..9551c8e36db7
--- /dev/null
+++ b/pkgs/tools/security/hash-slinger/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, pythonPackages, openssh, gnupg, unbound, libreswan }:
+
+stdenv.mkDerivation rec {
+  pname    = "hash-slinger";
+  name    = "${pname}-${version}";
+  version = "2.7";
+
+  src = fetchFromGitHub {
+    owner = "letoams";
+    repo = "${pname}";
+    rev = "${version}";
+    sha256 = "05wn744ydclpnpyah6yfjqlfjlasrrhzj48lqmm5a91nyps5yqyn";
+  };
+
+  pythonPath = with pythonPackages; [ dns m2crypto ipaddr python-gnupg
+                                      pyunbound ];
+
+  buildInputs = [ pythonPackages.wrapPython ];
+  propagatedBuildInputs = [ unbound libreswan ] ++ pythonPath;
+  propagatedUserEnvPkgs = [ unbound libreswan ];
+
+  patchPhase = ''
+    substituteInPlace Makefile \
+      --replace "$(DESTDIR)/usr" "$out"
+    substituteInPlace ipseckey \
+      --replace "/usr/sbin/ipsec" "${libreswan}/sbin/ipsec"
+    substituteInPlace tlsa \
+      --replace "/var/lib/unbound/root" "${pythonPackages.pyunbound}/etc/pyunbound/root"
+    patchShebangs *
+    '';
+
+  installPhase = ''
+    mkdir -p $out/bin $out/man $out/${python.sitePackages}/
+    make install
+    wrapPythonPrograms
+   '';
+
+   meta = {
+    description = "Various tools to generate special DNS records";
+    homepage    = "https://github.com/letoams/hash-slinger";
+    license     = stdenv.lib.licenses.gpl2Plus;
+    maintainers = [ stdenv.lib.maintainers.leenaars ];
+  };
+}