summaryrefslogtreecommitdiff
path: root/overlays/postfwd.nix
blob: 8a4f4bd8b8b343f0acd781eb27b716c826e6ec86 (plain)
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
{ final, prev, sources, ... }:
let
  deps = with final.perlPackages; [NetDNS NetServer IOMultiplex NetAddrIP NetCIDRLite DigestMD5 TimeHiRes Storable];
in {
  postfwd = prev.stdenv.mkDerivation rec {
    inherit (sources.postfwd) pname version src;

    nativeBuildInputs = with prev; [ makeWrapper ];
    propagatedBuildInputs = [final.perlPackages.perl] ++ deps;

    buildPhase = ''
      runHook preBuild

      substituteInPlace sbin/postfwd3 \
        --replace "/usr/bin/perl -T" "/usr/bin/perl"

      runHook postBuild
    '';

    installPhase = ''
      runHook preInstall

      mkdir -p $out/bin
      cp -t $out/bin sbin/postfwd3

      wrapProgram $out/bin/postfwd3 \
        --prefix PERL5LIB : ${final.perlPackages.makePerlPath deps}

      runHook postInstall
    '';
  };
}