diff options
author | Satoshi Shishiku <satoshi.shishiku@tuta.io> | 2017-03-01 00:57:02 +0000 |
---|---|---|
committer | Florian Jacob <projects+git@florianjacob.de> | 2017-11-01 13:38:01 +0100 |
commit | c75528bd566e99b3cfcb323d5e362d77a97e67c2 (patch) | |
tree | adb223f53aa029f85edc81361f4580ffaf6300c0 /nixos/modules/services/networking | |
parent | 57f3dd5a2f8c3b6cd10f6d94d52af48e18d3d540 (diff) | |
download | nixlib-c75528bd566e99b3cfcb323d5e362d77a97e67c2.tar nixlib-c75528bd566e99b3cfcb323d5e362d77a97e67c2.tar.gz nixlib-c75528bd566e99b3cfcb323d5e362d77a97e67c2.tar.bz2 nixlib-c75528bd566e99b3cfcb323d5e362d77a97e67c2.tar.lz nixlib-c75528bd566e99b3cfcb323d5e362d77a97e67c2.tar.xz nixlib-c75528bd566e99b3cfcb323d5e362d77a97e67c2.tar.zst nixlib-c75528bd566e99b3cfcb323d5e362d77a97e67c2.zip |
prosody service: add extra SSL options
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r-- | nixos/modules/services/networking/prosody.nix | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix index 27e96f66cf09..f34d8e172b46 100644 --- a/nixos/modules/services/networking/prosody.nix +++ b/nixos/modules/services/networking/prosody.nix @@ -10,17 +10,22 @@ let options = { - # TODO: require attribute key = mkOption { type = types.path; - description = "Path to the key file"; + description = "Path to the key file."; }; - # TODO: require attribute cert = mkOption { 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: - if o ? key && o ? cert then - ''ssl = { key = "${o.key}"; certificate = "${o.cert}"; };'' - else ""; + toLua = x: + if builtins.isString x then ''"${x}"'' + else if builtins.isBool x then toString x + 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 = { ... }: { |