git.iko.soy/typeable/nixpkgs
on master help sign in
prosody service: add extra SSL options
commitc75528bd566e99b3cfcb323d5e362d77a97e67c2 authorSatoshi Shishiku <satoshi.shishiku@tuta.io> dateWed 1 Mar 2017, 00:57 (10 years ago) parent57f3dd5
1 file changed+22−8
nixos/modules/services/networking/prosody.nix+22−8
nixos/modules/services/networking/prosody.nix+22−8
@@ -10,17 +10,22 @@ let
1010
1111 options = {
1212
13− # TODO: require attribute
1413 key = mkOption {
1514 type = types.path;
16− description = "Path to the key file";
15+ description = "Path to the key file.";
1716 };
1817
19− # TODO: require attribute
2018 cert = mkOption {
2119 type = types.path;
22− description = "Path to the certificate file";
20+ description = "Path to the certificate file.";
21+ };
22+
23+ extraOptions = mkOption {
24+ type = types.attrs;
25+ default = {};
26+ description = "Extra SSL configuration options.";
2327 };
28+
2429 };
2530 };
2631
@@ -112,10 +117,19 @@ let
112117
113118 };
114119
115− createSSLOptsStr = o:
116− if o ? key && o ? cert then
117− ''ssl = { key = "${o.key}"; certificate = "${o.cert}"; };''
118− else "";
120+ toLua = x:
121+ if builtins.isString x then ''"${x}"''
122+ else if builtins.isBool x then toString x
123+ else if builtins.isInt x then toString x
124+ else throw "Invalid Lua value";
125+
126+ createSSLOptsStr = o: ''
127+ ssl = {
128+ key = "${o.key}";
129+ certificate = "${o.cert}";
130+ ${concatStringsSep "\n" (mapAttrsToList (name: value: "${name} = ${toLua value};") o.extraOptions)}
131+ };
132+ '';
119133
120134 vHostOpts = { ... }: {
121135