home-manager/tests/modules/programs/khal/config.nix
Felipe Silva d579633ff9
khal: fix contact integration (#4836)
* khal: fix contact integration

- Add tests for contact+khal
- Make options `color`/`priority` available for contact accounts

* khal: add separate calendar for each contact collection

A contact account may have multiple VCARD collections, but Khal doesn't
search recursively. Collection folder names must be hardcoded, and each
has its own calendar.

- Add khal.collections option for contact accounts
- Default to previous setup for accounts with a single collection
- Add tests

* khal: specify how priority is defined by Khal

See https://khal.readthedocs.io/en/latest/configure.html
2024-03-03 18:12:42 +01:00

72 lines
1.6 KiB
Nix

{ ... }:
{
programs.khal = {
enable = true;
settings = {
default.timedelta = "5d";
view.agenda_event_format =
"{calendar-color}{cancelled}{start-end-time-style} {title}{repeat-symbol}{reset}";
};
};
accounts.calendar = {
basePath = "$XDG_CONFIG_HOME/cal";
accounts = {
test = {
primary = true;
primaryCollection = "test";
khal = {
enable = true;
readOnly = true;
type = "calendar";
};
local.type = "filesystem";
local.fileExt = ".ics";
name = "test";
remote = {
type = "http";
url = "https://example.com/events.ical";
};
};
};
};
accounts.contact = {
basePath = "$XDG_CONFIG_HOME/card";
accounts = {
testcontacts = {
khal = {
enable = true;
collections = [ "default" "automaticallyCollected" ];
};
local.type = "filesystem";
local.fileExt = ".vcf";
name = "testcontacts";
remote = {
type = "http";
url = "https://example.com/contacts.vcf";
};
};
testcontactsNoCollections = {
khal.enable = true;
local.type = "filesystem";
local.fileExt = ".vcf";
name = "testcontactsNoCollections";
remote = {
type = "http";
url = "https://example.com/contacts.vcf";
};
};
};
};
test.stubs = { khal = { }; };
nmt.script = ''
configFile=home-files/.config/khal/config
assertFileExists $configFile
assertFileContent $configFile ${./khal-config-expected}
'';
}