2017-07-31 11:24:55 +01:00
|
|
|
{ stdenv, fetchurl, writeText, nss, python3
|
2016-09-01 22:40:05 +01:00
|
|
|
, blacklist ? []
|
|
|
|
, includeEmail ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
certdata2pem = fetchurl {
|
|
|
|
name = "certdata2pem.py";
|
|
|
|
url = "https://anonscm.debian.org/cgit/collab-maint/ca-certificates.git/plain/mozilla/certdata2pem.py?h=debian/20160104";
|
|
|
|
sha256 = "0bw11mgfrf19qziyvdnq22kirp0nn54lfsanrg5h6djs6ig1c2im";
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
2010-01-20 14:10:26 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2015-05-29 21:51:55 +01:00
|
|
|
name = "nss-cacert-${nss.version}";
|
2010-01-20 14:10:26 +00:00
|
|
|
|
2015-05-29 21:51:55 +01:00
|
|
|
src = nss.src;
|
|
|
|
|
2017-07-31 11:24:55 +01:00
|
|
|
nativeBuildInputs = [ python3 ];
|
2016-05-11 21:50:49 +01:00
|
|
|
|
2016-09-01 22:40:05 +01:00
|
|
|
configurePhase = ''
|
|
|
|
ln -s nss/lib/ckfw/builtins/certdata.txt
|
|
|
|
|
|
|
|
cat << EOF > blacklist.txt
|
|
|
|
${concatStringsSep "\n" (map (c: ''"${c}"'') blacklist)}
|
|
|
|
EOF
|
2015-05-29 21:51:55 +01:00
|
|
|
|
2016-09-01 22:40:05 +01:00
|
|
|
cp ${certdata2pem} certdata2pem.py
|
|
|
|
${optionalString includeEmail ''
|
|
|
|
# Disable CAs used for mail signing
|
|
|
|
substituteInPlace certdata2pem.py --replace \[\'CKA_TRUST_EMAIL_PROTECTION\'\] '''
|
|
|
|
''}
|
|
|
|
'';
|
2010-01-20 14:10:26 +00:00
|
|
|
|
2015-05-29 21:51:55 +01:00
|
|
|
buildPhase = ''
|
2016-09-01 22:40:05 +01:00
|
|
|
python certdata2pem.py | grep -vE '^(!|UNTRUSTED)'
|
|
|
|
|
|
|
|
for cert in *.crt; do
|
|
|
|
echo $cert | cut -d. -f1 | sed -e 's,_, ,g' >> ca-bundle.crt
|
|
|
|
cat $cert >> ca-bundle.crt
|
|
|
|
echo >> ca-bundle.crt
|
|
|
|
done
|
2015-05-29 21:51:55 +01:00
|
|
|
'';
|
2010-01-20 14:10:26 +00:00
|
|
|
|
2015-05-29 21:51:55 +01:00
|
|
|
installPhase = ''
|
2015-06-05 21:00:52 +01:00
|
|
|
mkdir -pv $out/etc/ssl/certs
|
|
|
|
cp -v ca-bundle.crt $out/etc/ssl/certs
|
2015-05-29 21:51:55 +01:00
|
|
|
'';
|
2010-01-20 14:10:26 +00:00
|
|
|
|
2016-09-01 22:40:05 +01:00
|
|
|
meta = {
|
2010-01-20 14:10:26 +00:00
|
|
|
homepage = http://curl.haxx.se/docs/caextract.html;
|
|
|
|
description = "A bundle of X.509 certificates of public Certificate Authorities (CA)";
|
2015-05-29 21:51:55 +01:00
|
|
|
platforms = platforms.all;
|
2016-09-01 22:40:05 +01:00
|
|
|
maintainers = with maintainers; [ wkennington fpletz ];
|
2010-01-20 14:10:26 +00:00
|
|
|
};
|
|
|
|
}
|