From 808ba3267a2e12b5df3b9c4d372c77104582ad91 Mon Sep 17 00:00:00 2001 From: kiri Date: Sat, 29 Nov 2025 01:22:28 +0100 Subject: [PATCH] Add radicale server and khal/pimsync client --- home/programs/calendar/default.nix | 98 ++++++++++++++++++++++++++++++ hosts/orion/configuration.nix | 1 + hosts/polaris/home.nix | 1 + server-modules/radicale.nix | 25 ++++++++ 4 files changed, 125 insertions(+) create mode 100644 home/programs/calendar/default.nix create mode 100644 server-modules/radicale.nix diff --git a/home/programs/calendar/default.nix b/home/programs/calendar/default.nix new file mode 100644 index 0000000..0150d05 --- /dev/null +++ b/home/programs/calendar/default.nix @@ -0,0 +1,98 @@ +{ config, pkgs, ... }: +{ + programs.khal = { + enable = true; + locale = { + timeformat = "%H:%M"; + dateformat = "%m-%d"; + }; + }; + + programs.pimsync.enable = true; + services.pimsync.enable = true; + + accounts.calendar = { + basePath = "${config.xdg.dataHome}/calendars"; + accounts = { + "radicale" = { + primary = true; + primaryCollection = "personal"; + + local = { + type = "filesystem"; + fileExt = ".ics"; + }; + + remote = { + url = "https://radicale.jelles.net/"; + type = "caldav"; + userName = "kiri"; + # TODO: Bitwarden + passwordCommand = [ + "${pkgs.coreutils}/bin/cat" + "${config.xdg.configHome}/secrets/radicale_pass" + ]; + }; + + khal = { + enable = true; + type = "discover"; + color = "light blue"; + }; + + pimsync = { + enable = true; + extraPairDirectives = [ + { + name = "collections"; + params = [ "from b" ]; + } + ]; + }; + }; + "university" = { + remote = { + type = "http"; + }; + + local = { + type = "filesystem"; + fileExt = ".ics"; + }; + + pimsync = { + enable = true; + + extraRemoteStorageDirectives = [ + { + name = "collection_id"; + params = [ "events" ]; + } + { + name = "url"; + children = [ + { + name = "cmd"; + params = [ + "${pkgs.coreutils}/bin/cat" + "${config.xdg.configHome}/secrets/university_calendar_url" + ]; + } + ]; + } + ]; + extraPairDirectives = [ + { + name = "collection"; + params = [ "events" ]; + } + ]; + }; + khal = { + enable = true; + color = "#c72125"; + }; + }; + }; + }; +} diff --git a/hosts/orion/configuration.nix b/hosts/orion/configuration.nix index 1f2369e..9ce94e6 100644 --- a/hosts/orion/configuration.nix +++ b/hosts/orion/configuration.nix @@ -16,6 +16,7 @@ ../../server-modules/copyparty.nix ../../server-modules/home-assistant.nix ../../server-modules/glance.nix + ../../server-modules/radicale.nix ./disk-config.nix ./hardware-configuration.nix diff --git a/hosts/polaris/home.nix b/hosts/polaris/home.nix index f9b7e80..4564b9c 100644 --- a/hosts/polaris/home.nix +++ b/hosts/polaris/home.nix @@ -29,6 +29,7 @@ ../../home/programs/thunderbird ../../home/programs/bitwarden ../../home/programs/nixCats + ../../home/programs/calendar #../../home/programs/zen-browser # Scripts diff --git a/server-modules/radicale.nix b/server-modules/radicale.nix new file mode 100644 index 0000000..eee06c3 --- /dev/null +++ b/server-modules/radicale.nix @@ -0,0 +1,25 @@ +{ + services.radicale = { + enable = true; + settings = { + server = { + hosts = [ "127.0.0.1:5232" ]; + }; + auth = { + type = "htpasswd"; + htpasswd_filename = "/var/lib/radicale/users"; + htpasswd_encryption = "bcrypt"; + }; + storage = { + filesystem_folder = "/var/lib/radicale/collections"; + }; + }; + }; + + services.caddy.virtualHosts."radicale.jelles.net".extraConfig = '' + reverse_proxy :5232 { + header_up X-Script-Name / + header_up X-Forwarded-For {remote} + header_up X-Remote-User {http.auth.user.id} + }''; +}