Calendar and contacts sync

This commit is contained in:
Charlotte Van Petegem 2020-10-06 20:04:59 +02:00
parent 487917c7cc
commit a0ce6ef68c
No known key found for this signature in database
GPG key ID: 019E764B7184435A
4 changed files with 176 additions and 5 deletions

View file

@ -59,6 +59,9 @@ in
custom.zfs.homeLinks = [
{ path = "mail"; type = "data"; }
{ path = ".local/share/offlineimap"; type = "data"; }
{ path = ".local/share/contacts"; type = "data"; }
{ path = ".local/share/calendars"; type = "data"; }
{ path = ".local/share/vdirsyncer"; type = "data"; }
];
home-manager.users.charlotte = { ... }: {
accounts.email = {
@ -131,10 +134,114 @@ in
};
};
};
home.file.".mailcap".text = ''
text/html; ${pkgs.firefox}/bin/firefox %s ; nametemplate=%s.html; needsterminal
text/html; ${pkgs.w3m}/bin/w3m -I %{charset} -T text/html ; copiousoutput; nametemplate=%s.html
'';
home = {
packages = [ pkgs.khal pkgs.khard ];
file.".mailcap".text = ''
text/html; ${pkgs.firefox}/bin/firefox %s ; nametemplate=%s.html; needsterminal
text/html; ${pkgs.w3m}/bin/w3m -I %{charset} -T text/html ; copiousoutput; nametemplate=%s.html
'';
};
xdg.configFile = {
"khal/config".text = ''
[calendars]
[[calendar]]
path = ~/.local/share/calendars/*
type = discover
[locale]
timeformat = %H:%M
dateformat = %Y-%m-%d
longdateformat = %Y-%m-%d
datetimeformat = %Y-%m-%d %H:%M
longdatetimeformat = %Y-%m-%d %H:%M
'';
"khard/khard.conf".text = ''
[addressbooks]
[[contacts]]
path = ~/.local/share/contacts/contacts
[general]
debug = no
default_action = list
# These are either strings or comma seperated lists
editor = nvim
merge_editor = nvim, -d
[contact table]
# display names by first or last name: first_name / last_name / formatted_name
display = formatted_name
# group by address book: yes / no
group_by_addressbook = no
# reverse table ordering: yes / no
reverse = no
# append nicknames to name column: yes / no
show_nicknames = no
# show uid table column: yes / no
show_uids = yes
# sort by first or last name: first_name / last_name / formatted_name
sort = last_name
# localize dates: yes / no
localize_dates = yes
# set a comma separated list of preferred phone number types in descending priority
# or nothing for non-filtered alphabetical order
preferred_phone_number_type = pref, cell, home
# set a comma separated list of preferred email address types in descending priority
# or nothing for non-filtered alphabetical order
preferred_email_address_type = pref, work, home
[vcard]
# extend contacts with your own private objects
# these objects are stored with a leading "X-" before the object name in the vcard files
# every object label may only contain letters, digits and the - character
# example:
# private_objects = Jabber, Skype, Twitter
# default: , (the empty list)
private_objects = ,
# preferred vcard version: 3.0 / 4.0
preferred_version = 4.0
# Look into source vcf files to speed up search queries: yes / no
search_in_source_files = no
# skip unparsable vcard files: yes / no
skip_unparsable = no
'';
"vdirsyncer/config".text = ''
[general]
status_path = "~/.local/share/vdirsyncer"
[pair nextcloud_contacts]
a = "nextcloud_contacts_local"
b = "nextcloud_contacts_remote"
collections = ["from a", "from b"]
[storage nextcloud_contacts_local]
type = "filesystem"
path = "~/.local/share/contacts"
fileext = ".vcf"
[storage nextcloud_contacts_remote]
type = "carddav"
url = "https://nextcloud.vanpetegem.me/"
username = "chvp"
password.fetch = ["command", "${passwordScript}", "social/Nextcloud"]
[pair nextcloud_calendars]
a = "nextcloud_calendars_local"
b = "nextcloud_calendars_remote"
collections = ["from a", "from b"]
[storage nextcloud_calendars_local]
type = "filesystem"
path = "~/.local/share/calendars"
fileext = ".ics"
[storage nextcloud_calendars_remote]
type = "caldav"
url = "https://nextcloud.vanpetegem.me/"
username = "chvp"
password.fetch = ["command", "${passwordScript}", "social/Nextcloud"]
'';
};
programs = {
msmtp.enable = true;
neomutt = {
@ -162,6 +269,14 @@ in
};
Service = { ExecStart = "${pkgs.offlineimap}/bin/offlineimap"; };
};
vdirsyncer = {
Unit = {
Description = "VDirSyncer WebDAV syncer";
After = "network-online.target";
Wants = "network-online.target";
};
Service = { ExecStart = "${pkgs.vdirsyncer}/bin/vdirsyncer sync"; };
};
} // lib.listToAttrs (map genNotifyImapPatch [ "jonggroen" "personal" "postbot" "posteo" "webmaster" "work" ]);
timers = {
offlineimap = {
@ -172,6 +287,14 @@ in
};
Install = { WantedBy = [ "timers.target" ]; };
};
vdirsyncer = {
Unit = { Description = "VDirSyncer WebDAV syncer"; };
Timer = {
OnCalendar = "*:0/5";
Unit = "vdirsyncer.service";
};
Install = { WantedBy = [ "timers.target" ]; };
};
};
};
};

View file

@ -126,7 +126,7 @@ in
workspace 1
exec ${pkgs.firefox}/bin/firefox
workspace 3
exec ${pkgs.thunderbird}/bin/thunderbird
exec ${pkgs.kitty}/bin/kitty -e ${pkgs.tmuxinator}/bin/tmuxinator start mail
workspace 4
exec ${pkgs.element-desktop}/bin/element-desktop
workspace 5

View file

@ -19,6 +19,7 @@
xdg.configFile = {
"tmuxinator/accentor.yml".source = ./tmux/accentor.yml;
"tmuxinator/dodona.yml".source = ./tmux/dodona.yml;
"tmuxinator/mail.yml".source = ./tmux/mail.yml;
};
};
}

View file

@ -0,0 +1,47 @@
# /home/charlotte/.config/tmuxinator/mail.yml
name: mail
root: ~/mail
# Optional tmux socket
# socket_name: foo
# Note that the pre and post options have been deprecated and will be replaced by
# project hooks.
# Project hooks
# Runs on project start, always
# on_project_start: command
# Run on project start, the first time
# on_project_first_start: command
# Run on project start, after the first time
# on_project_restart: command
# Run on project exit ( detaching from tmux session )
# on_project_exit: command
# Run on project stop
# on_project_stop: command
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
# pre_window: rbenv shell 2.0.0-p247
# Pass command line options to tmux. Useful for specifying a different tmux.conf.
# tmux_options: -f ~/.tmux.mac.conf
# Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
# tmux_command: byobu
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
# startup_window: editor
# Specifies (by index) which pane of the specified window will be selected on project startup. If not set, the first pane is used.
# startup_pane: 1
# Controls whether the tmux session should be attached to automatically. Defaults to true.
# attach: false
windows:
- main:
layout: main-vertical
panes:
- neomutt
- khal interactive