-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
services/vdirsyncer: init #3912
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably want to do metasync
as well as sync
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 discover
requires you to get the configuration file, I fix this by having avsync
alias in my configuration with the proper configuration. It can also runvdirsyncer discover
by 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
.