From e1680d594a9281651cbf7d126941a8c8e2396183 Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Wed, 3 Dec 2025 04:02:13 +0000 Subject: [PATCH] pimsync: Make storage names unique This includes the calendar/contacts prefix in the storage name as well as the pair name to ensure that if the same name is used for contacts and calendar then it is correctly referenced. (cherry picked from commit 43173abcb4a48adb1d56be30ed17d9afaf4310ae) --- modules/programs/pimsync/default.nix | 8 ++-- tests/modules/programs/pimsync/basic.nix | 4 +- tests/modules/programs/pimsync/basic.scfg | 46 +++++++++++------------ 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/modules/programs/pimsync/default.nix b/modules/programs/pimsync/default.nix index b8edb7df..bf772c8f 100644 --- a/modules/programs/pimsync/default.nix +++ b/modules/programs/pimsync/default.nix @@ -51,7 +51,7 @@ localStorage = calendar: name: acc: { name = "storage"; - params = [ "${name}-local" ]; + params = [ "${if calendar then "calendar" else "contacts"}-${name}-local" ]; children = (attrsToDirectives { inherit (acc.local) path; @@ -63,7 +63,7 @@ remoteStorage = calendar: name: acc: { name = "storage"; - params = [ "${name}-remote" ]; + params = [ "${if calendar then "calendar" else "contacts"}-${name}-remote" ]; children = (attrsToDirectives { inherit (acc.remote) url; @@ -91,8 +91,8 @@ params = lib.singleton "${if calendar then "calendar" else "contacts"}-${name}"; children = (attrsToDirectives { - storage_a = "${name}-local"; - storage_b = "${name}-remote"; + storage_a = "${if calendar then "calendar" else "contacts"}-${name}-local"; + storage_b = "${if calendar then "calendar" else "contacts"}-${name}-remote"; }) ++ acc.pimsync.extraPairDirectives; }; diff --git a/tests/modules/programs/pimsync/basic.nix b/tests/modules/programs/pimsync/basic.nix index 2f9ae61e..f029ea1f 100644 --- a/tests/modules/programs/pimsync/basic.nix +++ b/tests/modules/programs/pimsync/basic.nix @@ -1,6 +1,6 @@ { accounts.calendar = { - accounts.caldav = { + accounts.mine = { pimsync.enable = true; remote = { passwordCommand = [ @@ -23,7 +23,7 @@ }; accounts.contact = { - accounts.carddav = { + accounts.mine = { pimsync.enable = true; remote = { passwordCommand = [ diff --git a/tests/modules/programs/pimsync/basic.scfg b/tests/modules/programs/pimsync/basic.scfg index a035e788..6d09cbb3 100644 --- a/tests/modules/programs/pimsync/basic.scfg +++ b/tests/modules/programs/pimsync/basic.scfg @@ -1,14 +1,18 @@ -storage caldav-local { - fileext .ics - path /home/hm-user/.local/state/calendar/caldav - type vdir/icalendar -} -storage http-local { +storage calendar-http-local { fileext .ics path /home/hm-user/.local/state/calendar/http type vdir/icalendar } -storage caldav-remote { +storage calendar-mine-local { + fileext .ics + path /home/hm-user/.local/state/calendar/mine + type vdir/icalendar +} +storage calendar-http-remote { + type webcal + url https://example.com/calendar +} +storage calendar-mine-remote { type caldav url https://caldav.example.com username alice @@ -16,24 +20,20 @@ storage caldav-remote { cmd pass caldav } } -storage http-remote { - type webcal - url https://example.com/calendar -} -pair calendar-caldav { - storage_a caldav-local - storage_b caldav-remote -} pair calendar-http { - storage_a http-local - storage_b http-remote + storage_a calendar-http-local + storage_b calendar-http-remote } -storage carddav-local { +pair calendar-mine { + storage_a calendar-mine-local + storage_b calendar-mine-remote +} +storage contacts-mine-local { fileext .vcf - path /home/hm-user/.local/state/contact/carddav + path /home/hm-user/.local/state/contact/mine type vdir/vcard } -storage carddav-remote { +storage contacts-mine-remote { type carddav url https://carddav.example.com username bob @@ -41,8 +41,8 @@ storage carddav-remote { cmd pass carddav } } -pair contacts-carddav { - storage_a carddav-local - storage_b carddav-remote +pair contacts-mine { + storage_a contacts-mine-local + storage_b contacts-mine-remote } status_path /test/dir