nixos/swanctl: fix the cert and cacert options

The function `mkPostfixedAttrsOfParams` was used to define these
options while in the strongsan documentation, their structure is
pretty similar to the `local` and `remote` options which are defined
with `mkPrefixedAttrsOfParams`:

In 6856bfe5bc/src/swanctl/swanctl.opt,
they are defined such as:

- connections.<conn>.local<suffix>.cert<suffix>
- connections.<conn>.remote<suffix>.cacert<suffix>

Since `mkPostfixedAttrsOfParams` is no longer used, it is removed.
This commit is contained in:
Antoine Eiche 2026-03-05 08:43:06 +01:00
commit ba944f68df
2 changed files with 3 additions and 18 deletions

View file

@ -149,19 +149,4 @@ rec {
paramsToRenderedStrings prefixedAttrs (mapAttrs (_n: _v: p) prefixedAttrs);
};
mkPostfixedAttrsOfParams = params: description: {
_type = "param";
option = mkOption {
type = types.attrsOf (types.submodule { options = paramsToOptions params; });
default = { };
description = description;
};
render =
postfix: attrs:
let
postfixedAttrs = mapAttrs' (name: nameValuePair "${name}-${postfix}") attrs;
in
paramsToRenderedStrings postfixedAttrs (mapAttrs (_n: _v: params) postfixedAttrs);
};
}

View file

@ -433,7 +433,7 @@ in
located, the first certificate is used.
'';
cert = mkPostfixedAttrsOfParams certParams ''
cert = mkPrefixedAttrsOfParams certParams ''
Section for a certificate candidate to use for
authentication. Certificates in certs are transmitted as binary blobs,
these sections offer more flexibility.
@ -568,7 +568,7 @@ in
or an absolute path.
'';
cert = mkPostfixedAttrsOfParams certParams ''
cert = mkPrefixedAttrsOfParams certParams ''
Section for a certificate candidate to use for
authentication. Certificates in certs are transmitted as binary blobs,
these sections offer more flexibility.
@ -590,7 +590,7 @@ in
swanctl `x509ca` directory or an absolute path.
'';
cacert = mkPostfixedAttrsOfParams certParams ''
cacert = mkPrefixedAttrsOfParams certParams ''
Section for a CA certificate to accept for authentication. Certificates
in cacerts are transmitted as binary blobs, these sections offer more
flexibility.