From 4a26e21030a6ea9adbcc967812286bbe71fe45c5 Mon Sep 17 00:00:00 2001 From: Janik <80165193+Janik-Haag@users.noreply.github.com> Date: Tue, 4 Jul 2023 12:14:47 +0200 Subject: [PATCH] programs.khal moved highlight_event_days where appropriated and added tests --- modules/accounts/calendar.nix | 2 +- modules/programs/khal.nix | 2 +- tests/default.nix | 1 + tests/modules/programs/khal/config.nix | 32 +++++++++++++++++++++++++ tests/modules/programs/khal/default.nix | 1 + 5 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 tests/modules/programs/khal/config.nix create mode 100644 tests/modules/programs/khal/default.nix diff --git a/modules/accounts/calendar.nix b/modules/accounts/calendar.nix index d53d3afa..e96f2f2d 100644 --- a/modules/accounts/calendar.nix +++ b/modules/accounts/calendar.nix @@ -12,7 +12,7 @@ let path = mkOption { type = types.str; default = "${cfg.basePath}/${name}"; - defaultText = "‹accounts.contact.basePath›/‹name›"; + defaultText = "‹accounts.calendar.basePath›/‹name›"; description = "The path of the storage."; }; diff --git a/modules/programs/khal.nix b/modules/programs/khal.nix index 555a3b80..209716a1 100644 --- a/modules/programs/khal.nix +++ b/modules/programs/khal.nix @@ -25,7 +25,6 @@ let genCalendarStr = name: value: concatStringsSep "\n" ([ "[[${name}]]" - "highlight_event_days = True" "path = ${ value.local.path + "/" + (optionalString (value.khal.type == "discover") value.khal.glob) @@ -158,6 +157,7 @@ in { # locale = definedAttrs (cfg.locale // { _module = null; }); default = optionalAttrs (!isNull primaryAccount) { + highlight_event_days = true; default_calendar = if isNull primaryAccount.primaryCollection then primaryAccount.name else diff --git a/tests/default.nix b/tests/default.nix index c04de313..ae11853b 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -88,6 +88,7 @@ import nmt { ./modules/programs/k9s ./modules/programs/kakoune ./modules/programs/kitty + ./modules/programs/khal ./modules/programs/ledger ./modules/programs/less ./modules/programs/lf diff --git a/tests/modules/programs/khal/config.nix b/tests/modules/programs/khal/config.nix new file mode 100644 index 00000000..1633d132 --- /dev/null +++ b/tests/modules/programs/khal/config.nix @@ -0,0 +1,32 @@ +{ ... }: + +{ + programs.khal.enable = true; + 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"; + }; + }; + }; + }; + + test.stubs = { khal = { }; }; + + nmt.script = '' + assertFileExists home-files/.config/khal/config + ''; +} diff --git a/tests/modules/programs/khal/default.nix b/tests/modules/programs/khal/default.nix new file mode 100644 index 00000000..999dc4c5 --- /dev/null +++ b/tests/modules/programs/khal/default.nix @@ -0,0 +1 @@ +{ khal-config = ./config.nix; }