prosody service: add extra SSL options

This commit is contained in:
Satoshi Shishiku 2017-03-01 00:57:02 +00:00 committed by Florian Jacob
parent 57f3dd5a2f
commit c75528bd56

View file

@ -10,17 +10,22 @@ let
options = { options = {
# TODO: require attribute
key = mkOption { key = mkOption {
type = types.path; type = types.path;
description = "Path to the key file"; description = "Path to the key file.";
}; };
# TODO: require attribute
cert = mkOption { cert = mkOption {
type = types.path; type = types.path;
description = "Path to the certificate file"; description = "Path to the certificate file.";
}; };
extraOptions = mkOption {
type = types.attrs;
default = {};
description = "Extra SSL configuration options.";
};
}; };
}; };
@ -112,10 +117,19 @@ let
}; };
createSSLOptsStr = o: toLua = x:
if o ? key && o ? cert then if builtins.isString x then ''"${x}"''
''ssl = { key = "${o.key}"; certificate = "${o.cert}"; };'' else if builtins.isBool x then toString x
else ""; else if builtins.isInt x then toString x
else throw "Invalid Lua value";
createSSLOptsStr = o: ''
ssl = {
key = "${o.key}";
certificate = "${o.cert}";
${concatStringsSep "\n" (mapAttrsToList (name: value: "${name} = ${toLua value};") o.extraOptions)}
};
'';
vHostOpts = { ... }: { vHostOpts = { ... }: {