services/vdirsyncer: init#3912
Conversation
ef3f9fe to
c80bc5e
Compare
|
might be nice to add a test to easily see how to use it. It doesn't use any "contact" infrastructure but that's something that we want to support later right ? |
|
FYI, the "unknown format" that vdirsyncer uses is configobj |
Thank you! |
Yes and yes! |
| with lib; | ||
| let | ||
| cfg = config.services.vdirsyncer; | ||
| formatToUnknownFormat = settings: |
There was a problem hiding this comment.
Looks like the format they use is basically INI but with JSON values... https://github.com/pimutils/vdirsyncer/blob/079a156bf82fe86173d0d05ec0937703b5c6a735/vdirsyncer/cli/config.py#L151
So like,
settingsFormat = {
type = types.attrsOf (types.attrsOf (pkgs.formats.json {}).type);
generate = name: value: pkgs.writeText name (lib.generators.toINI {
mkKeyValue = lib.generators.mkKeyValueDefault {
mkValueString = builtins.toJSON;
} " = ";
} value);
};| in { | ||
| options.services.vdirsyncer = { | ||
| enable = mkEnableOption "synchronization of calendars"; | ||
| settings = mkOption { type = types.attrs; }; |
There was a problem hiding this comment.
Needs a description, default value and better type (see above)
| configFile = mkOption { | ||
| type = types.path; | ||
| default = cfgFile; | ||
| }; | ||
| onBootSec = mkOption { | ||
| type = types.str; | ||
| default = "15min"; | ||
| }; | ||
| onUnitActiveSec = mkOption { | ||
| type = types.str; | ||
| default = "30min"; | ||
| }; |
There was a problem hiding this comment.
These need descriptions. I'd also get rid of configFile for now, unless there's a good reason to have it.
| pkgs.writeText "vdirsyncer.conf" (formatToUnknownFormat cfg.settings); | ||
| in { | ||
| options.services.vdirsyncer = { | ||
| enable = mkEnableOption "synchronization of calendars"; |
There was a problem hiding this comment.
| enable = mkEnableOption "synchronization of calendars"; | |
| enable = mkEnableOption "synchronization of calendars via vdirsyncer"; |
| Install.WantedBy = [ "default.target" ]; | ||
|
|
||
| Service = { | ||
| ExecStart = "${pkgs.vdirsyncer}/bin/vdirsyncer -c ${cfgFile} sync"; |
There was a problem hiding this comment.
We probably want to do metasync as well as sync.
There was a problem hiding this comment.
as mentioned here: #3982 (comment)
we should probably do vdirsyncer discover before sync and metasync
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
|
we already have the service. I dont close in case you want to merge missing features . |
Will take a look and see what I can do. |
|
Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting. If you are the original author of the PR
If you are not the original author of the PR
|
Description
This introduces a vdirsyncer service I use in my configuration.
It has some shortcomings:
vdirsyncer discoverrequires you to get the configuration file, I fix this by having avsyncalias in my configuration with the proper configuration. It can also runvdirsyncer discoverby itself, but I think it requires interactivity, so it is annoying.Checklist
Change is backwards compatible.
Code formatted with
./format.Code tested through
nix-shell --pure tests -A run.all.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Added myself as module maintainer. See example.
Added myself and the module files to
.github/CODEOWNERS.