fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge PR #421575790441

master
4.9 KiB187 linesraw
1{ lib, ... }:
2
3with lib;
4
5let
6
7  collection = types.either types.str (types.listOf types.str);
8
9in {
10  options.vdirsyncer = {
11    enable = mkEnableOption "synchronization using vdirsyncer";
12
13    collections = mkOption {
14      type = types.nullOr (types.listOf collection);
15      default = null;
16      description = ''
17        The collections to synchronize between the storages.
18      '';
19    };
20
21    conflictResolution = mkOption {
22      type = types.nullOr
23        (types.either (types.enum [ "remote wins" "local wins" ])
24          (types.listOf types.str));
25      default = null;
26      description = ''
27        What to do in case of a conflict between the storages. Either
28        `remote wins` or
29        `local wins` or
30        a list that contains a command to run. By default, an error
31        message is printed.
32      '';
33    };
34
35    partialSync = mkOption {
36      type = types.nullOr (types.enum [ "revert" "error" "ignore" ]);
37      default = null;
38      description = ''
39        What should happen if synchronization in one direction
40        is impossible due to one storage being read-only.
41        Defaults to `revert`.
42
43        See
44        <https://vdirsyncer.pimutils.org/en/stable/config.html#pair-section>
45        for more information.
46      '';
47    };
48
49    metadata = mkOption {
50      type = types.listOf types.str;
51      default = [ ];
52      example = [ "color" "displayname" ];
53      description = ''
54        Metadata keys that should be synchronized when vdirsyncer
55        metasync is executed.
56      '';
57    };
58
59    timeRange = mkOption {
60      type = types.nullOr (types.submodule {
61        options = {
62          start = mkOption {
63            type = types.str;
64            description = "Start of time range to show.";
65          };
66
67          end = mkOption {
68            type = types.str;
69            description = "End of time range to show.";
70          };
71        };
72      });
73      default = null;
74      description = ''
75        A time range to synchronize. start and end can be any Python
76        expression that returns a `datetime.datetime`
77        object.
78      '';
79      example = {
80        start = "datetime.now() - timedelta(days=365)";
81        end = "datetime.now() + timedelta(days=365)";
82      };
83    };
84
85    itemTypes = mkOption {
86      type = types.nullOr (types.listOf types.str);
87      default = null;
88      description = ''
89        Kinds of items to show. The default is to show everything.
90        This depends on particular features of the server, the results
91        are not validated.
92      '';
93    };
94
95    verify = mkOption {
96      type = types.nullOr types.bool;
97      default = null;
98      description = "Verify SSL certificate.";
99    };
100
101    verifyFingerprint = mkOption {
102      type = types.nullOr types.str;
103      default = null;
104      description = ''
105        Optional. SHA1 or MD5 fingerprint of the expected server certificate.
106
107        See
108        <https://vdirsyncer.pimutils.org/en/stable/ssl-tutorial.html#ssl-tutorial>
109        for more information.
110      '';
111    };
112
113    auth = mkOption {
114      type = types.nullOr (types.enum [ "basic" "digest" "guess" ]);
115      default = null;
116      description = ''
117        Authentication settings. The default is `basic`.
118      '';
119    };
120
121    authCert = mkOption {
122      type = types.nullOr (types.either types.str (types.listOf types.str));
123      default = null;
124      description = ''
125        Either a path to a certificate with a client certificate and
126        the key or a list of paths to the files with them.
127      '';
128    };
129
130    userAgent = mkOption {
131      type = types.nullOr types.str;
132      default = null;
133      description = ''
134        The user agent to report to the server. Defaults to
135        `vdirsyncer`.
136      '';
137    };
138
139    postHook = mkOption {
140      type = types.lines;
141      default = "";
142      description = ''
143        Command to call for each item creation and modification.
144        The command will be called with the path of the new/updated
145        file.
146      '';
147    };
148
149    ## Options for google storages
150
151    tokenFile = mkOption {
152      type = types.nullOr types.str;
153      default = null;
154      description = ''
155        A file path where access tokens are stored.
156      '';
157    };
158
159    clientIdCommand = mkOption {
160      type = types.nullOr (types.listOf types.str);
161      default = null;
162      example = [ "pass" "client_id" ];
163      description = ''
164        A command that prints the OAuth credentials to standard
165        output.
166
167        See
168        <https://vdirsyncer.pimutils.org/en/stable/config.html#google>
169        for more information.
170      '';
171    };
172
173    clientSecretCommand = mkOption {
174      type = types.nullOr (types.listOf types.str);
175      default = null;
176      example = [ "pass" "client_secret" ];
177      description = ''
178        A command that prints the OAuth credentials to standard
179        output.
180
181        See
182        <https://vdirsyncer.pimutils.org/en/stable/config.html#google>
183        for more information.
184      '';
185    };
186  };
187}