2023-06-12 23:21:24 +02:00
|
|
|
{ lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
collection = types.either types.str (types.listOf types.str);
|
|
|
|
|
|
|
|
in {
|
|
|
|
options.vdirsyncer = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "synchronization using vdirsyncer";
|
2023-06-12 23:21:24 +02:00
|
|
|
|
2023-09-03 11:01:36 +02:00
|
|
|
urlCommand = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
|
|
|
example = [ "~/get-url.sh" ];
|
|
|
|
description = "A command that prints the URL of the storage.";
|
|
|
|
};
|
|
|
|
|
|
|
|
userNameCommand = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
|
|
|
example = [ "~/get-username.sh" ];
|
|
|
|
description = "A command that prints the user name to standard output.";
|
|
|
|
};
|
|
|
|
|
2023-06-12 23:21:24 +02:00
|
|
|
collections = mkOption {
|
|
|
|
type = types.nullOr (types.listOf collection);
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
The collections to synchronize between the storages.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
conflictResolution = mkOption {
|
|
|
|
type = types.nullOr
|
|
|
|
(types.either (types.enum [ "remote wins" "local wins" ])
|
|
|
|
(types.listOf types.str));
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
What to do in case of a conflict between the storages. Either
|
2023-07-01 01:30:13 +02:00
|
|
|
`remote wins` or
|
|
|
|
`local wins` or
|
2023-06-12 23:21:24 +02:00
|
|
|
a list that contains a command to run. By default, an error
|
|
|
|
message is printed.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
partialSync = mkOption {
|
|
|
|
type = types.nullOr (types.enum [ "revert" "error" "ignore" ]);
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
What should happen if synchronization in one direction
|
|
|
|
is impossible due to one storage being read-only.
|
2023-07-01 01:30:13 +02:00
|
|
|
Defaults to `revert`.
|
|
|
|
|
2023-06-12 23:21:24 +02:00
|
|
|
See
|
2023-07-01 01:30:13 +02:00
|
|
|
<https://vdirsyncer.pimutils.org/en/stable/config.html#pair-section>
|
2023-06-12 23:21:24 +02:00
|
|
|
for more information.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
metadata = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [ ];
|
|
|
|
example = [ "color" "displayname" ];
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
Metadata keys that should be synchronized when vdirsyncer
|
|
|
|
metasync is executed.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
timeRange = mkOption {
|
|
|
|
type = types.nullOr (types.submodule {
|
|
|
|
options = {
|
|
|
|
start = mkOption {
|
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Start of time range to show.";
|
2023-06-12 23:21:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
end = mkOption {
|
|
|
|
type = types.str;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "End of time range to show.";
|
2023-06-12 23:21:24 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
A time range to synchronize. start and end can be any Python
|
2023-07-01 01:30:13 +02:00
|
|
|
expression that returns a `datetime.datetime`
|
2023-06-12 23:21:24 +02:00
|
|
|
object.
|
|
|
|
'';
|
|
|
|
example = {
|
|
|
|
start = "datetime.now() - timedelta(days=365)";
|
|
|
|
end = "datetime.now() + timedelta(days=365)";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
itemTypes = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
Kinds of items to show. The default is to show everything.
|
|
|
|
This depends on particular features of the server, the results
|
|
|
|
are not validated.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
verify = mkOption {
|
2024-03-06 21:19:45 +01:00
|
|
|
type = types.nullOr types.path;
|
2023-06-12 23:21:24 +02:00
|
|
|
default = null;
|
2024-03-06 21:19:45 +01:00
|
|
|
description = "Null or path to certificate to verify SSL against";
|
|
|
|
example = "/path/to/cert.pem";
|
2023-06-12 23:21:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
verifyFingerprint = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
Optional. SHA1 or MD5 fingerprint of the expected server certificate.
|
2023-07-01 01:30:13 +02:00
|
|
|
|
2023-06-12 23:21:24 +02:00
|
|
|
See
|
2023-07-01 01:30:13 +02:00
|
|
|
<https://vdirsyncer.pimutils.org/en/stable/ssl-tutorial.html#ssl-tutorial>
|
2023-06-12 23:21:24 +02:00
|
|
|
for more information.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
auth = mkOption {
|
|
|
|
type = types.nullOr (types.enum [ "basic" "digest" "guess" ]);
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-07-01 01:30:13 +02:00
|
|
|
Authentication settings. The default is `basic`.
|
2023-06-12 23:21:24 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
authCert = mkOption {
|
|
|
|
type = types.nullOr (types.either types.str (types.listOf types.str));
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
Either a path to a certificate with a client certificate and
|
|
|
|
the key or a list of paths to the files with them.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
userAgent = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
The user agent to report to the server. Defaults to
|
2023-07-01 01:30:13 +02:00
|
|
|
`vdirsyncer`.
|
2023-06-12 23:21:24 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
postHook = mkOption {
|
2024-02-05 00:07:19 +01:00
|
|
|
type = types.nullOr types.lines;
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
Command to call for each item creation and modification.
|
|
|
|
The command will be called with the path of the new/updated
|
|
|
|
file.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
## Options for google storages
|
|
|
|
|
|
|
|
tokenFile = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
A file path where access tokens are stored.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
clientIdCommand = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
|
|
|
example = [ "pass" "client_id" ];
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
A command that prints the OAuth credentials to standard
|
|
|
|
output.
|
2023-07-01 01:30:13 +02:00
|
|
|
|
2023-06-12 23:21:24 +02:00
|
|
|
See
|
2023-07-01 01:30:13 +02:00
|
|
|
<https://vdirsyncer.pimutils.org/en/stable/config.html#google>
|
2023-06-12 23:21:24 +02:00
|
|
|
for more information.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
clientSecretCommand = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
|
|
|
example = [ "pass" "client_secret" ];
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-12 23:21:24 +02:00
|
|
|
A command that prints the OAuth credentials to standard
|
|
|
|
output.
|
2023-07-01 01:30:13 +02:00
|
|
|
|
2023-06-12 23:21:24 +02:00
|
|
|
See
|
2023-07-01 01:30:13 +02:00
|
|
|
<https://vdirsyncer.pimutils.org/en/stable/config.html#google>
|
2023-06-12 23:21:24 +02:00
|
|
|
for more information.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|