# CLI calendar application (khal) { config, lib, pkgs, ... }: let cfg = config.office.khal; icons = config.desktop.icons.apps; calendarPath = "${config.xdg.dataHome}/khal/calendars"; base16Colors = import ../../colors/base16 { inherit config lib pkgs; }; in { options.office.khal = { enable = lib.mkEnableOption "khal, a CLI calendar application"; package = lib.mkOption { type = lib.types.package; readOnly = true; default = config.programs.khal.package; description = "The khal package to use."; }; }; config = lib.mkIf cfg.enable { programs.khal = { enable = true; locale = { timeformat = "%H:%M"; dateformat = "%Y-%m-%d"; longdateformat = "%Y-%m-%d"; datetimeformat = "%Y-%m-%d %H:%M"; longdatetimeformat = "%Y-%m-%d %H:%M"; }; settings.default = { default_calendar = "personal"; default_dayevent_duration = "1d"; default_event_duration = "1h"; enable_mouse = true; timedelta = "2d"; }; settings.view.theme = "dark"; }; accounts.calendar = { basePath = calendarPath; accounts.personal = { khal = { enable = true; color = base16Colors.colorsWithHashPrefix.base0D; }; local.type = "filesystem"; }; }; xdg.desktopEntries."khal" = lib.mkIf (config.terminal.kitty.enable && cfg.package != null) { name = "khal"; exec = "${lib.getExe config.terminal.kitty.package} --class khal -e ${lib.getExe' cfg.package "khal"} interactive"; icon = icons.khal or "calendar"; categories = [ "Office" "Calendar" ]; comment = "CLI calendar application"; terminal = false; type = "Application"; }; }; }