2014-04-14 18:26:48 +04:00
|
|
|
{ config, lib, pkgs, ... }:
|
2010-01-20 17:22:47 +03:00
|
|
|
|
2014-04-14 18:26:48 +04:00
|
|
|
with lib;
|
2010-01-20 17:22:47 +03:00
|
|
|
|
2015-02-15 20:55:07 +03: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 17:22:47 +03:00
|
|
|
{
|
|
|
|
|
2015-02-05 20:06:57 +03:00
|
|
|
options = {
|
|
|
|
|
|
|
|
security.pki.certificateFiles = mkOption {
|
|
|
|
type = types.listOf types.path;
|
|
|
|
default = [];
|
2015-06-05 23:00:52 +03:00
|
|
|
example = literalExample "[ \"\${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt\" ]";
|
2015-02-05 20:06:57 +03: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 {
|
2015-06-15 19:18:46 +03:00
|
|
|
type = types.listOf types.str;
|
2015-02-05 20:06:57 +03:00
|
|
|
default = [];
|
|
|
|
example = singleton ''
|
|
|
|
NixOS.org
|
|
|
|
=========
|
|
|
|
-----BEGIN CERTIFICATE-----
|
|
|
|
MIIGUDCCBTigAwIBAgIDD8KWMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYDVQQGEwJJ
|
|
|
|
TDEWMBQGA1UEChMNU3RhcnRDb20gTHRkLjErMCkGA1UECxMiU2VjdXJlIERpZ2l0
|
|
|
|
...
|
|
|
|
-----END CERTIFICATE-----
|
|
|
|
'';
|
|
|
|
description = ''
|
|
|
|
A list of trusted root certificates in PEM format.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-01-20 17:22:47 +03:00
|
|
|
config = {
|
|
|
|
|
2015-06-05 23:00:52 +03:00
|
|
|
security.pki.certificateFiles = [ "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ];
|
2015-02-05 20:06:57 +03:00
|
|
|
|
2015-02-15 21:03:14 +03:00
|
|
|
# NixOS canonical location + Debian/Ubuntu/Arch/Gentoo compatibility.
|
|
|
|
environment.etc."ssl/certs/ca-certificates.crt".source = caBundle;
|
|
|
|
|
|
|
|
# Old NixOS compatibility.
|
2015-02-15 20:55:07 +03: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 19:56:46 +04:00
|
|
|
environment.sessionVariables =
|
2015-02-15 21:03:14 +03:00
|
|
|
{ SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt";
|
2014-12-02 01:07:50 +03:00
|
|
|
# FIXME: unneeded - remove eventually.
|
2015-02-15 21:03:14 +03:00
|
|
|
GIT_SSL_CAINFO = "/etc/ssl/certs/ca-certificates.crt";
|
2014-06-10 15:07:10 +04:00
|
|
|
};
|
2011-09-14 22:20:50 +04:00
|
|
|
|
2010-01-20 17:22:47 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|