about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/hash-slinger/default.nix
blob: b8759d3571b5e268c605195edbfb472ca41df19d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ lib, stdenv, fetchFromGitHub, pythonPackages, unbound, libreswan }:

let
  inherit (pythonPackages) python;
in stdenv.mkDerivation rec {
  pname    = "hash-slinger";
  version = "2.7";

  src = fetchFromGitHub {
    owner = "letoams";
    repo = pname;
    rev = version;
    sha256 = "05wn744ydclpnpyah6yfjqlfjlasrrhzj48lqmm5a91nyps5yqyn";
  };

  pythonPath = with pythonPackages; [ dnspython 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     = lib.licenses.gpl2Plus;
    maintainers = [ lib.maintainers.leenaars ];
  };
}