2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2010-01-20 14:22:47 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2010-01-20 14:22:47 +00:00
|
|
|
|
2015-02-15 17:55:07 +00:00
|
|
|
let
|
|
|
|
|
|
|
|
caBundle = pkgs.runCommand "ca-bundle.crt"
|
|
|
|
{ files =
|
|
|
|
config.security.pki.certificateFiles ++
|
|
|
|
[ (builtins.toFile "extra.crt" (concatStringsSep "\n" config.security.pki.certificates)) ];
|
|
|
|
}
|
|
|
|
''
|
|
|
|
cat $files > $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2010-01-20 14:22:47 +00:00
|
|
|
{
|
|
|
|
|
2015-02-05 17:06:57 +00:00
|
|
|
options = {
|
|
|
|
|
|
|
|
security.pki.certificateFiles = mkOption {
|
|
|
|
type = types.listOf types.path;
|
|
|
|
default = [];
|
2015-06-05 20:00:52 +00:00
|
|
|
example = literalExample "[ \"\${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt\" ]";
|
2015-02-05 17:06:57 +00:00
|
|
|
description = ''
|
|
|
|
A list of files containing trusted root certificates in PEM
|
|
|
|
format. These are concatenated to form
|
|
|
|
<filename>/etc/ssl/certs/ca-bundle.crt</filename>, which is
|
|
|
|
used by many programs that use OpenSSL, such as
|
|
|
|
<command>curl</command> and <command>git</command>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
security.pki.certificates = mkOption {
|
|
|
|
type = types.listOf types.string;
|
|
|
|
default = [];
|
|
|
|
example = singleton ''
|
|
|
|
NixOS.org
|
|
|
|
=========
|
|
|
|
-----BEGIN CERTIFICATE-----
|
|
|
|
MIIGUDCCBTigAwIBAgIDD8KWMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJJ
|
|
|
|
TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0
|
|
|
|
...
|
|
|
|
-----END CERTIFICATE-----
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
A list of trusted root certificates in PEM format.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-01-20 14:22:47 +00:00
|
|
|
config = {
|
|
|
|
|
2015-06-05 20:00:52 +00:00
|
|
|
security.pki.certificateFiles = [ "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ];
|
2015-02-05 17:06:57 +00:00
|
|
|
|
2015-02-15 18:03:14 +00:00
|
|
|
# NixOS canonical location + Debian/Ubuntu/Arch/Gentoo compatibility.
|
|
|
|
environment.etc."ssl/certs/ca-certificates.crt".source = caBundle;
|
|
|
|
|
|
|
|
# Old NixOS compatibility.
|
2015-02-15 17:55:07 +00:00
|
|
|
environment.etc."ssl/certs/ca-bundle.crt".source = caBundle;
|
|
|
|
|
|
|
|
# CentOS/Fedora compatibility.
|
|
|
|
environment.etc."pki/tls/certs/ca-bundle.crt".source = caBundle;
|
|
|
|
|
2014-06-13 15:56:46 +00:00
|
|
|
environment.sessionVariables =
|
2015-02-15 18:03:14 +00:00
|
|
|
{ SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt";
|
2014-07-28 17:06:09 +00:00
|
|
|
# FIXME: unneeded - remove eventually.
|
2015-02-15 18:03:14 +00:00
|
|
|
OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt";
|
2014-12-01 22:07:50 +00:00
|
|
|
# FIXME: unneeded - remove eventually.
|
2015-02-15 18:03:14 +00:00
|
|
|
GIT_SSL_CAINFO = "/etc/ssl/certs/ca-certificates.crt";
|
2014-06-10 11:07:10 +00:00
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2010-01-20 14:22:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|