about summary refs log tree commit diff
path: root/pkgs/by-name/cl/clatd/package.nix
blob: f18ab3b036ceaf89f6004eaff491a3147e5765cc (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, perl
, perlPackages
, tayga
, iproute2
, iptables
, nixosTests
}:

stdenv.mkDerivation rec {
  pname = "clatd";
  version = "1.6";

  src = fetchFromGitHub {
    owner = "toreanderson";
    repo = "clatd";
    rev = "v${version}";
    hash = "sha256-ZUGWQTXXgATy539NQxkZSvQA7HIWkIPsw1NJrz0xKEg=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    makeWrapper
    perl # for pod2man
  ];

  buildInputs = with perlPackages; [
    perl
    NetIP
    NetDNS
  ];

  makeFlags = [ "PREFIX=$(out)" ];

  preBuild = ''
    mkdir -p $out/{sbin,share/man/man8}
  '';

  postFixup = ''
    patchShebangs $out/bin/clatd
    wrapProgram $out/bin/clatd \
      --set PERL5LIB $PERL5LIB \
      --prefix PATH : ${
        lib.makeBinPath [
          tayga
          iproute2
          iptables
        ]
      }
  '';

  passthru.tests.clatd = nixosTests.clatd;

  meta = with lib; {
    description = "A 464XLAT CLAT implementation for Linux";
    homepage = "https://github.com/toreanderson/clatd";
    license = licenses.mit;
    maintainers = with maintainers; [ jmbaur ];
    mainProgram = "clatd";
    platforms = platforms.linux;
  };
}