From 5095577e3b03867b1524b433c341c9e4c4992f9f Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Tue, 2 Sep 2025 21:33:25 +0200 Subject: [PATCH] radicale: Add birthday calendar generating hook --- flake.lock | 17 +++++++++++++++++ flake.nix | 5 +++++ modules/system/services/radicale.nix | 6 ++++++ 3 files changed, 28 insertions(+) diff --git a/flake.lock b/flake.lock index 25c2a9d..ba9fce1 100644 --- a/flake.lock +++ b/flake.lock @@ -268,6 +268,22 @@ "type": "github" } }, + "radicale-birthday-calendar": { + "flake": false, + "locked": { + "lastModified": 1738694693, + "narHash": "sha256-X/tahL01rGyc6eg1UqXhINi0mbuhwdzi4cYN8B0K+5c=", + "owner": "iBigQ", + "repo": "radicale-birthday-calendar", + "rev": "535ae54ef6464b1aba825af794ecc4c4dbf3d3c3", + "type": "github" + }, + "original": { + "owner": "iBigQ", + "repo": "radicale-birthday-calendar", + "type": "github" + } + }, "root": { "inputs": { "betterfox": "betterfox", @@ -281,6 +297,7 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", + "radicale-birthday-calendar": "radicale-birthday-calendar", "sops": "sops", "treefmt": "treefmt", "vscode-extensions": "vscode-extensions" diff --git a/flake.nix b/flake.nix index c8a7504..b575b0a 100644 --- a/flake.nix +++ b/flake.nix @@ -57,6 +57,11 @@ url = "https://github.com/nextcloud-releases/twofactor_totp/releases/download/v6.4.1/twofactor_totp-v6.4.1.tar.gz"; flake = false; }; + + radicale-birthday-calendar = { + url = "github:iBigQ/radicale-birthday-calendar"; + flake = false; + }; }; outputs = diff --git a/modules/system/services/radicale.nix b/modules/system/services/radicale.nix index d749393..d0f2ca2 100644 --- a/modules/system/services/radicale.nix +++ b/modules/system/services/radicale.nix @@ -1,5 +1,6 @@ { config, + inputs, pkgs, lib, ... @@ -43,9 +44,12 @@ in htpasswd_filename = config.sops.templates."radicale/htpasswd".path; htpasswd_encryption = "plain"; }; + storage.filesystem_folder = "/var/lib/radicale/collections"; storage.hook = let + createBirthdayCalendar = "${inputs.radicale-birthday-calendar}/create_birthday_calendar.py"; + hookScript = pkgs.writeShellApplication { name = "radicale-git-hook"; runtimeInputs = [ @@ -61,6 +65,8 @@ in text = '' readonly username="$1" + git status --porcelain | awk '{print $2}' | python3 ${createBirthdayCalendar} + git add -A if ! git diff --cached --quiet; then git commit --message "Changes by $username"