From 6f0a5fcc305fe216dd261d0e9fc334b01843c851 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 21 May 2024 23:13:44 +0300 Subject: [PATCH] users/jan: add calendars --- modules/home-manager/programs/calendar.nix | 25 +++++++++++++++++---- modules/nixos/configs/nix.nix | 3 +++ users/jan/calendars.secret.nix | Bin 0 -> 427 bytes users/jan/default.nix | 5 +++++ 4 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 users/jan/calendars.secret.nix diff --git a/modules/home-manager/programs/calendar.nix b/modules/home-manager/programs/calendar.nix index 0ca6823..e5c66d0 100644 --- a/modules/home-manager/programs/calendar.nix +++ b/modules/home-manager/programs/calendar.nix @@ -1,11 +1,14 @@ -{ config, pkgs, lib, ... }: +{ config, lib, ... }: let cfg = config.local.programs.calendar; mkCalOpts = name: { enable = lib.mkEnableOption name; - package = lib.mkPackageOption pkgs name { }; + + # Custom package doesn't work yet. + # See: https://github.com/nix-community/home-manager/pull/5428 + # package = lib.mkPackageOption pkgs name { }; }; in { @@ -13,6 +16,20 @@ in khal = mkCalOpts "khal"; }; - config.home.packages = - lib.optional cfg.khal.enable cfg.khal.package; + config = { + accounts.calendar.basePath = "${config.xdg.dataHome}/calendars"; + + programs.khal = lib.mkIf cfg.khal.enable { + enable = true; + locale = rec { + timeformat = "%H:%M"; + dateformat = "%Y-%m-%d"; + longdateformat = dateformat; + datetimeformat = "${dateformat} ${timeformat}"; + longdatetimeformat = datetimeformat; + }; + # See: https://khal.readthedocs.io/en/latest/configure.html + settings = {}; + }; + }; } diff --git a/modules/nixos/configs/nix.nix b/modules/nixos/configs/nix.nix index e0bf4a7..aa47876 100644 --- a/modules/nixos/configs/nix.nix +++ b/modules/nixos/configs/nix.nix @@ -42,6 +42,9 @@ in }; }; }) + (final: prev: { + khal = (import inputs.nixpkgs-unstable { inherit (config.nixpkgs) system; }).khal; + }) (final: prev: { unstable = import inputs.nixpkgs-unstable { inherit (config.nixpkgs) config overlays system; diff --git a/users/jan/calendars.secret.nix b/users/jan/calendars.secret.nix new file mode 100644 index 0000000000000000000000000000000000000000..760366c6616ba882c0cb953de39e7caf02478ea8 GIT binary patch literal 427 zcmV;c0aX3~M@dveQdv+`093(^WwP1K?KJs9;f-1EagI-V^TrnAo>~^zHqxIX@n<5b z*~wHTebf7&Mavuf#jg=7E4z)VB-_OczQ;IgTTd6-3_~ioc`TW3S|N5Kv(v(OyE#Fm zoj_rP%ojzR^0HtztwG9U_i~kJY5d@__${6n_;|R%q!w{Q0fjSc21(an89IdZw?zm+f`Nkg;%{d@C-RL%d`Vl2; z%UShxm};ELPf414L6AWMYK@{0T6c!I@A#gy^rHt&VOVV*Hh?@3yr}8JEyPWfLk&Ke V64B4Z7Il;Jx6_6OsfoZg4Ic*1%K-oY literal 0 HcmV?d00001 diff --git a/users/jan/default.nix b/users/jan/default.nix index 7d23168..78bcebd 100644 --- a/users/jan/default.nix +++ b/users/jan/default.nix @@ -56,6 +56,7 @@ home-manager.users.jan = { imports = [ ./email_accounts.secret.nix + ./calendars.secret.nix ./git ]; @@ -95,6 +96,10 @@ local.programs.file-managers.vifm.enable = lib.mkDefault true; local.programs.aerc.enable = lib.mkDefault true; + local.programs.calendar.khal = { + enable = lib.mkDefault true; + # package = pkgs.unstable.khal; + }; local.programs.communication = { telegram.enable = lib.mkDefault true;