git.iko.soy/typeable/nixpkgs
on master help sign in
strongswan: allow configuring enabled plugins
commit7f921735e76076196a93fa55c234a6f1d01534a9 authorAndrew Dunham <andrew@du.nham.ca> dateFri 22 Sep 2017, 03:39 (9 years ago) parent0807f4a
1 file changed+23−2
nixos/modules/services/networking/strongswan.nix+23−2
nixos/modules/services/networking/strongswan.nix+23−2
@@ -32,8 +32,10 @@ let
3232 ${caConf}
3333 '';
3434
35− strongswanConf = {setup, connections, ca, secrets}: toFile "strongswan.conf" ''
35+ strongswanConf = {setup, connections, ca, secrets, managePlugins, enabledPlugins}: toFile "strongswan.conf" ''
3636 charon {
37+ ${if managePlugins then "load_modular = no" else ""}
38+ ${if managePlugins then ("load = " + (concatStringsSep " " enabledPlugins)) else ""}
3739 plugins {
3840 stroke {
3941 secrets_file = ${ipsecSecrets secrets}
@@ -112,6 +114,25 @@ in
112114 file.
113115 '';
114116 };
117+
118+ managePlugins = mkOption {
119+ type = types.bool;
120+ default = false;
121+ description = ''
122+ If set to true, this option will disable automatic plugin loading and
123+ then tell strongSwan to enable the plugins specified in the
124+ <option>enabledPlugins</option> option.
125+ '';
126+ };
127+
128+ enabledPlugins = mkOption {
129+ type = types.listOf types.str;
130+ default = [];
131+ description = ''
132+ A list of additional plugins to enable if
133+ <option>managePlugins</option> is true.
134+ '';
135+ };
115136 };
116137
117138 config = with cfg; mkIf enable {
@@ -122,7 +143,7 @@ in
122143 wants = [ "keys.target" ];
123144 after = [ "network-online.target" "keys.target" ];
124145 environment = {
125− STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secrets; };
146+ STRONGSWAN_CONF = strongswanConf { inherit setup connections ca secrets managePlugins enabledPlugins; };
126147 };
127148 serviceConfig = {
128149 ExecStart = "${pkgs.strongswan}/sbin/ipsec start --nofork";