diff options
author | Yureka <yuka@yuka.dev> | 2024-01-30 12:47:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-30 12:47:33 +0100 |
commit | a6c64fbd3980f14d5338d010d2c30534ac05515c (patch) | |
tree | 6db2d5eb70019414d9828d94bf0da292a3f69844 /nixos/modules/services/networking | |
parent | ba5f81a6b69d4b1235ee70379c6bb3984afb5d59 (diff) | |
download | nixlib-a6c64fbd3980f14d5338d010d2c30534ac05515c.tar nixlib-a6c64fbd3980f14d5338d010d2c30534ac05515c.tar.gz nixlib-a6c64fbd3980f14d5338d010d2c30534ac05515c.tar.bz2 nixlib-a6c64fbd3980f14d5338d010d2c30534ac05515c.tar.lz nixlib-a6c64fbd3980f14d5338d010d2c30534ac05515c.tar.xz nixlib-a6c64fbd3980f14d5338d010d2c30534ac05515c.tar.zst nixlib-a6c64fbd3980f14d5338d010d2c30534ac05515c.zip |
nixos/strongswan-swanctl: add includes option for secrets (#284742)
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r-- | nixos/modules/services/networking/strongswan-swanctl/module.nix | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/strongswan-swanctl/module.nix b/nixos/modules/services/networking/strongswan-swanctl/module.nix index a98850923955..c1f0aeb64e96 100644 --- a/nixos/modules/services/networking/strongswan-swanctl/module.nix +++ b/nixos/modules/services/networking/strongswan-swanctl/module.nix @@ -5,6 +5,9 @@ with (import ./param-lib.nix lib); let cfg = config.services.strongswan-swanctl; + configFile = pkgs.writeText "swanctl.conf" + ( (paramsToConf cfg.swanctl swanctlParams) + + (concatMapStrings (i: "\ninclude ${i}") cfg.includes)); swanctlParams = import ./swanctl-params.nix lib; in { options.services.strongswan-swanctl = { @@ -21,6 +24,13 @@ in { }; swanctl = paramsToOptions swanctlParams; + includes = mkOption { + type = types.listOf types.path; + default = []; + description = '' + Extra configuration files to include in the swanctl configuration. This can be used to provide secret values from outside the nix store. + ''; + }; }; config = mkIf cfg.enable { @@ -31,8 +41,7 @@ in { } ]; - environment.etc."swanctl/swanctl.conf".text = - paramsToConf cfg.swanctl swanctlParams; + environment.etc."swanctl/swanctl.conf".source = configFile; # The swanctl command complains when the following directories don't exist: # See: https://wiki.strongswan.org/projects/strongswan/wiki/Swanctldirectory |