1{ lib
2, stdenv
3, fetchFromGitHub
4, python3
5, unbound
6, libreswan
7}:
8
9stdenv.mkDerivation rec {
10 pname = "hash-slinger";
11 version = "3.2";
12
13 src = fetchFromGitHub {
14 owner = "letoams";
15 repo = pname;
16 rev = version;
17 sha256 = "sha256-PfOEGqPMGLixoqHENZnxOv9nK+dYMqe6P0k+ZiJMik0=";
18 };
19
20 pythonPath = with python3.pkgs; [
21 dnspython
22 m2crypto
23 python-gnupg
24 pyunbound
25 ];
26
27 buildInputs = [
28 python3.pkgs.wrapPython
29 ];
30
31 propagatedBuildInputs = [
32 unbound
33 libreswan
34 ] ++ pythonPath;
35
36 propagatedUserEnvPkgs = [
37 unbound
38 libreswan
39 ];
40
41 postPatch = ''
42 substituteInPlace Makefile \
43 --replace "$(DESTDIR)/usr" "$out"
44 substituteInPlace ipseckey \
45 --replace "/usr/sbin/ipsec" "${libreswan}/sbin/ipsec"
46 substituteInPlace tlsa \
47 --replace "/var/lib/unbound/root" "${python3.pkgs.pyunbound}/etc/pyunbound/root"
48 patchShebangs *
49 '';
50
51 installPhase = ''
52 mkdir -p $out/bin $out/man $out/lib/${python3.libPrefix}/site-packages
53 make install
54 wrapPythonPrograms
55 '';
56
57 meta = with lib; {
58 description = "Various tools to generate special DNS records";
59 homepage = "https://github.com/letoams/hash-slinger";
60 license = licenses.gpl2Plus;
61 maintainers = with maintainers; [ leenaars ];
62 };
63}