summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/networking/libreswan.nix
diff options
context:
space:
mode:
authorFelix Buehler <account@buehler.rocks>2023-06-24 20:19:19 +0200
committerFelix Buehler <account@buehler.rocks>2023-06-24 20:19:19 +0200
commitf3719756b550113c1acbbab00c89a56fb77256f2 (patch)
treea94f6678f9b1b25c6773bdd7a35422aabc816032 /nixos/modules/services/networking/libreswan.nix
parente9e3f2e7362aba3ef709173d1777f0b893fc0ebf (diff)
treewide: use optionalString instead of 'then ""'
Diffstat (limited to 'nixos/modules/services/networking/libreswan.nix')
-rw-r--r--nixos/modules/services/networking/libreswan.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/services/networking/libreswan.nix b/nixos/modules/services/networking/libreswan.nix
index 785729d8f742..b8a3d6c8fdb5 100644
--- a/nixos/modules/services/networking/libreswan.nix
+++ b/nixos/modules/services/networking/libreswan.nix
@@ -14,8 +14,8 @@ let
nonchars = filter (x : !(elem x.value chars))
(imap0 (i: v: {ind = i; value = v;}) (stringToCharacters str));
in
- if length nonchars == 0 then ""
- else substring (head nonchars).ind (add 1 (sub (last nonchars).ind (head nonchars).ind)) str;
+ lib.optionalString (length nonchars != 0)
+ (substring (head nonchars).ind (add 1 (sub (last nonchars).ind (head nonchars).ind)) str);
indent = str: concatStrings (concatMap (s: [" " (trim [" " "\t"] s) "\n"]) (splitString "\n" str));
configText = indent (toString cfg.configSetup);
connectionText = concatStrings (mapAttrsToList (n: v: