caldav: add vdirsyncer+todoman config

This commit is contained in:
Leonardo Eugênio 2023-01-25 00:26:39 -03:00
parent 4a53c981ae
commit 0700c353b4
2 changed files with 85 additions and 0 deletions

View file

@ -19,6 +19,7 @@
./chat.nix ./chat.nix
./email.nix ./email.nix
./syncthing.nix ./syncthing.nix
./vdir.nix
./bmenu.nix ./bmenu.nix
./fzf.nix ./fzf.nix
./ranger ./ranger

84
user/vdir.nix Normal file
View file

@ -0,0 +1,84 @@
{ pkgs, lib, ... }:
let
inherit (pkgs.uservars) nextcloud;
pass_cmd = (pkgs.writeShellScript "get_pass" ''
pass "${nextcloud.pass}" | head -n1
'');
in
{
systemd.user.services.vdirsyncer = {
Unit = {
Description = "vdirsyncer calendar and contacts synchronization";
};
Service = {
Type = "oneshot";
ExecStartPre = "yes | ${pkgs.vdirsyncer}/bin/vdirsyncer discover";
ExecStart = "${pkgs.vdirsyncer}/bin/vdirsyncer sync";
};
};
systemd.user.timers.vdirsyncer = {
Unit = { Description = "vdirsyncer calendar and contacts synchronization"; };
Timer = {
OnCalendar = "*:0/30";
Unit = "vdirsyncer.service";
};
Install = { WantedBy = [ "timers.target" ]; };
};
xdg.configFile = {
"vdirsyncer/config".text = ''
[general]
status_path = "~/.vdirsyncer/status/"
[pair contacts]
a = "contacts_local"
b = "contacts_remote"
collections = ["from a", "from b"]
metadata = ["displayname"]
[storage contacts_local]
type = "filesystem"
path = "~/.local/share/contacts/"
fileext = ".vcf"
[storage contacts_remote]
type = "carddav"
url = "https://${ nextcloud.host }/remote.php/dav/addressbooks/users/${ nextcloud.user }/"
username = "${ nextcloud.user }"
password.fetch = [ "command", "${ pass_cmd }" ]
[pair calendar]
a = "calendar_local"
b = "calendar_remote"
collections = ["from a", "from b"]
metadata = ["displayname", "color"]
[storage calendar_local]
type = "filesystem"
path = "~/.local/share/calendars/"
fileext = ".ics"
[storage calendar_remote]
type = "caldav"
url = "https://${ nextcloud.host }/remote.php/dav/calendars/${ nextcloud.user }/"
username = "${ nextcloud.user }"
password.fetch = [ "command", "${ pass_cmd }" ]
'';
"todoman/config.py".text = ''
path = "~/.local/share/calendars/*"
date_format = "%Y-%m-%d"
time_format = "%H:%M"
default_list = "Personal"
default_due = 48
'';
};
home.packages = with pkgs; [
vdirsyncer
todoman
];
}