Malte Tammena
9bada411db
To prepare for an addiotional /users/modules which can be shared between users.
77 lines
1.8 KiB
Nix
77 lines
1.8 KiB
Nix
{ pkgs, ... }:
|
|
|
|
let
|
|
defaultCalendar = "Malte";
|
|
khalConfig = ''
|
|
[calendars]
|
|
|
|
[[local]]
|
|
path = ~/.local/share/calendars/*
|
|
type = discover
|
|
|
|
[locale]
|
|
timeformat = %H:%M
|
|
dateformat = %d.%m.%Y
|
|
longdateformat = %d.%m.%Y
|
|
datetimeformat = %d.%m.%Y %H:%M
|
|
longdatetimeformat = %d.%m.%Y %H:%M
|
|
|
|
[default]
|
|
default_calendar = ${defaultCalendar}
|
|
'';
|
|
vdirsyncerConfig = ''
|
|
[general]
|
|
status_path = "~/.local/state/vdirsyncer/status/"
|
|
|
|
[pair mysync]
|
|
a = "local"
|
|
b = "caltammenarocks"
|
|
collections = ["from a", "from b"]
|
|
|
|
metadata = ["displayname", "color"]
|
|
|
|
[storage local]
|
|
type = "filesystem"
|
|
path = "~/.local/share/calendars"
|
|
fileext = ".ics"
|
|
|
|
[storage caltammenarocks]
|
|
type = "caldav"
|
|
url = "https://cal.tammena.rocks/malte/"
|
|
username = "malte"
|
|
password.fetch = ["command", "${pkgs.pass}/bin/pass", "show", "Server/Radicale/malte"]
|
|
'';
|
|
|
|
in {
|
|
home.packages = [ pkgs.vdirsyncer ];
|
|
|
|
# == Systemd settings to automatically run the sync ==
|
|
systemd.user.services."synchronize-calendars" = {
|
|
Unit = {
|
|
Description = "Synchronize my calendars using vdirsyncer";
|
|
Requisite = "dev-yubikey.device";
|
|
After = "dev-yubikey.device";
|
|
};
|
|
Service = {
|
|
Type = "oneshot";
|
|
Environment =
|
|
[ "PASSWORD_STORE_DIR=/home/malte/.local/share/password-store" ];
|
|
ExecStart = ''
|
|
${pkgs.vdirsyncer}/bin/vdirsyncer sync
|
|
'';
|
|
};
|
|
};
|
|
|
|
systemd.user.timers."synchronize-calendars" = {
|
|
Unit = {
|
|
Description = "Run synchronize-calendars.service every 15 minutes";
|
|
};
|
|
Timer = { OnCalendar = "*:0/10"; };
|
|
Install = { WantedBy = [ "timers.target" ]; };
|
|
};
|
|
|
|
# == Configuration ==
|
|
xdg.configFile."khal/config".text = khalConfig;
|
|
xdg.configFile."vdirsyncer/config".text = vdirsyncerConfig;
|
|
}
|