summary refs log tree commit diff
path: root/pkgs/tools/networking/ssmtp/default.nix
blob: 6957d43e791311beecf13be6e86d6640f8f1511a (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
{lib, stdenv, fetchurl, tlsSupport ? true, openssl ? null}:

assert tlsSupport -> openssl != null;

stdenv.mkDerivation {
  name = "ssmtp-2.64";

  src = fetchurl {
    url = "mirror://debian/pool/main/s/ssmtp/ssmtp_2.64.orig.tar.bz2";
    sha256 = "0dps8s87ag4g3jr6dk88hs9zl46h3790marc5c2qw7l71k4pvhr2";
  };

  # A request has been made to merge this patch into ssmtp.
  # See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=858781
  patches = [ ./ssmtp_support_AuthPassFile_parameter.patch ];

  configureFlags = [
    "--sysconfdir=/etc"
    (lib.enableFeature tlsSupport "ssl")
  ];

  postConfigure =
    ''
      # Don't run the script that interactively generates a config file.
      # Also don't install the broken, cyclic symlink /lib/sendmail.
      sed -e '/INSTALLED_CONFIGURATION_FILE/d' \
          -e 's|/lib/sendmail|$(TMPDIR)/sendmail|' \
          -i Makefile
      substituteInPlace Makefile \
        --replace '$(INSTALL) -s' '$(INSTALL) -s --strip-program $(STRIP)'
    '';

  installFlags = [ "etcdir=$(out)/etc" ];

  installTargets = [ "install" "install-sendmail" ];

  buildInputs = lib.optional tlsSupport openssl;

  NIX_LDFLAGS = lib.optionalString tlsSupport "-lcrypto";

  meta = with lib; {
    platforms = platforms.linux;
    license = licenses.gpl2;
    maintainers = with maintainers; [ basvandijk ];
  };
}