From 34db2f05219bcb0e41cc85490e4c338e2405546c Mon Sep 17 00:00:00 2001 From: simfu Date: Fri, 7 Jul 2023 13:57:22 +0200 Subject: [PATCH] unison: Allow using same option multiple times (#4208) Unison supports the same option to be given several times as a command line argument (e.g. unison -path xxx -path yyy). This commit adds Home Manager support for this by allowing a list of strings to be given to services.unison.pairs..commandOptions values. # Veuillez saisir le message de validation pour vos modifications. Les lignes --- modules/services/unison.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/services/unison.nix b/modules/services/unison.nix index d7f8a628a..e32f70522 100644 --- a/modules/services/unison.nix +++ b/modules/services/unison.nix @@ -22,7 +22,7 @@ let }; commandOptions = mkOption rec { - type = with types; attrsOf str; + type = with types; attrsOf (either str (listOf str)); apply = mergeAttrs default; default = { repeat = "watch"; @@ -36,6 +36,8 @@ let Additional command line options as a dictionary to pass to the unison program. + Use a list of strings to declare the same option multiple times. + See unison @@ -60,7 +62,9 @@ let }; }; - serialiseArg = key: val: escapeShellArg "-${key}=${escape [ "=" ] val}"; + serialiseArg = key: val: + concatStringsSep " " + (forEach (toList val) (x: escapeShellArg "-${key}=${escape [ "=" ] x}")); serialiseArgs = args: concatStringsSep " " (mapAttrsToList serialiseArg args);