1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

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.<name>.commandOptions values.

 # Veuillez saisir le message de validation pour vos modifications. Les lignes
This commit is contained in:
simfu 2023-07-07 13:57:22 +02:00 committed by GitHub
parent 719de878f7
commit 34db2f0521
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
<literal>unison</literal> program.
</para><para>
Use a list of strings to declare the same option multiple times.
</para><para>
See
<citerefentry>
<refentrytitle>unison</refentrytitle>
@ -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);