summaryrefslogtreecommitdiff
path: root/pkgs/data/misc/cacert/default.nix
blob: 3ce6dc81a3967c37977119e3a6b19c336153de3b (about) (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
33
34
35
36
{ stdenv, nss, curl, perl }:

stdenv.mkDerivation rec {
  name = "nss-cacert-${nss.version}";

  src = nss.src;

  postPatch = ''
    unpackFile ${curl.src};

    # Remove dependency on LWP, curl is enough. Also, since curl here
    # is working on a local file it will not actually get a 200 OK, so
    # remove that expectation.
    substituteInPlace curl-*/lib/mk-ca-bundle.pl \
      --replace 'use LWP::UserAgent;' "" \
      --replace ' && $out[0] == 200' ""
  '';

  nativeBuildInputs = [ curl perl ];

  buildPhase = ''
    perl curl-*/lib/mk-ca-bundle.pl -d "file://$(pwd)/nss/lib/ckfw/builtins/certdata.txt" ca-bundle.crt
  '';

  installPhase = ''
    mkdir -pv $out/etc/ssl/certs
    cp -v ca-bundle.crt $out/etc/ssl/certs
  '';

  meta = with stdenv.lib; {
    homepage = http://curl.haxx.se/docs/caextract.html;
    description = "A bundle of X.509 certificates of public Certificate Authorities (CA)";
    platforms = platforms.all;
    maintainers = with maintainers; [ wkennington ];
  };
}