2019-12-14 16:15:33 +00:00
|
|
|
{ stdenv, fetchurl, nss, python3
|
2016-09-01 22:40:05 +01:00
|
|
|
, blacklist ? []
|
|
|
|
, includeEmail ? false
|
|
|
|
}:
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
certdata2pem = fetchurl {
|
|
|
|
name = "certdata2pem.py";
|
2018-06-02 01:56:53 +01:00
|
|
|
url = "https://salsa.debian.org/debian/ca-certificates/raw/debian/20170717/mozilla/certdata2pem.py";
|
2018-03-14 14:21:52 +00:00
|
|
|
sha256 = "1d4q27j1gss0186a5m8bs5dk786w07ccyq0qi6xmd2zr1a8q16wy";
|
2016-09-01 22:40:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
2010-01-20 14:10:26 +00:00
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation {
|
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;
|
|
|
|
|
2018-02-25 22:23:59 +00:00
|
|
|
outputs = [ "out" "unbundled" ];
|
|
|
|
|
2019-12-14 16:15:33 +00: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
|
|
|
|
2017-08-09 18:51:25 +01:00
|
|
|
cat ${certdata2pem} > certdata2pem.py
|
|
|
|
patch -p1 < ${./fix-unicode-ca-names.patch}
|
2016-09-01 22:40:05 +01:00
|
|
|
${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
|
2018-02-25 22:23:59 +00:00
|
|
|
# install individual certs in unbundled output
|
|
|
|
mkdir -pv $unbundled/etc/ssl/certs
|
|
|
|
cp -v *.crt $unbundled/etc/ssl/certs
|
|
|
|
rm -f $unbundled/etc/ssl/certs/ca-bundle.crt # not wanted in unbundled
|
2015-05-29 21:51:55 +01:00
|
|
|
'';
|
2010-01-20 14:10:26 +00:00
|
|
|
|
2017-12-23 14:13:29 +00:00
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2016-09-01 22:40:05 +01:00
|
|
|
meta = {
|
2017-08-02 22:50:51 +01:00
|
|
|
homepage = https://curl.haxx.se/docs/caextract.html;
|
2010-01-20 14:10:26 +00:00
|
|
|
description = "A bundle of X.509 certificates of public Certificate Authorities (CA)";
|
2015-05-29 21:51:55 +01:00
|
|
|
platforms = platforms.all;
|
2019-01-26 10:01:09 +00:00
|
|
|
maintainers = with maintainers; [ fpletz ];
|
2010-01-20 14:10:26 +00:00
|
|
|
};
|
|
|
|
}
|