From 9f1cf602e5bd327c433dd8233ab8d0e24d9e5421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Tue, 24 Dec 2024 13:24:41 +0100 Subject: [PATCH] feat: add calendar and contacts modules --- hosts/nixos-laptop/default.nix | 3 ++ modules/profiles/personal_calendar.nix | 52 ++++++++++++++++++++++++++ modules/profiles/personal_contacts.nix | 50 +++++++++++++++++++++++++ modules/profiles/personal_mail.nix | 2 + secrets/nextcloud.age | 9 +++++ secrets/secrets.nix | 1 + 6 files changed, 117 insertions(+) create mode 100644 modules/profiles/personal_calendar.nix create mode 100644 modules/profiles/personal_contacts.nix create mode 100644 secrets/nextcloud.age diff --git a/hosts/nixos-laptop/default.nix b/hosts/nixos-laptop/default.nix index 0b79e01..79a118d 100644 --- a/hosts/nixos-laptop/default.nix +++ b/hosts/nixos-laptop/default.nix @@ -18,6 +18,9 @@ profiles = { desktop.enable = true; personal.enable = true; + personal.mail = true; + personal.contacts = true; + personal.calendar = true; webis.enable = true; impermanence.enable = true; }; diff --git a/modules/profiles/personal_calendar.nix b/modules/profiles/personal_calendar.nix new file mode 100644 index 0000000..49512fe --- /dev/null +++ b/modules/profiles/personal_calendar.nix @@ -0,0 +1,52 @@ +{ lib +, config +, pkgs +, ... +}: + +with lib; +let + cfg = config.my.profiles.personal; +in +{ + options.my.profiles.personal.calendar = mkEnableOption "calendar"; + + config = mkIf cfg.contacts { + home-manager.users.moritz = { + programs.khal.enable = true; + programs.vdirsyncer.enable = true; + services.vdirsyncer.enable = true; + accounts.calendar = { + basePath = "Documents/Calendar"; + accounts.personal = { + local = { + type = "filesystem"; + fileExt = ".ics"; + }; + remote = { + passwordCommand = [ "cat" "/run/agenix/nextcloud" ]; + url = "https://nextcloud.moritzboeh.me/remote.php/dav"; + type = "caldav"; + userName = "moritz"; + }; + primaryCollection = "personal"; + khal.enable = true; + khal.type = "discover"; + vdirsyncer.enable = true; + vdirsyncer.collections = [ + "personal" # Personal + "einkaufsliste" # Einkaufsliste + "9b8be6f3-d85c-4c1e-b006-00910f56bf5d" # Tasks + "contact_birthdays" # Contact birthdays + "f71a1a0f-08c5-45de-84e8-e7f16b748ba5" # Uni + "32c96d6f-a575-48b1-949a-6ae548f7a779" # Work + ]; + }; + }; + }; + age.secrets.nextcloud = { + file = ../../secrets/nextcloud.age; + owner = "1000"; + }; + }; +} diff --git a/modules/profiles/personal_contacts.nix b/modules/profiles/personal_contacts.nix new file mode 100644 index 0000000..0e8b1b4 --- /dev/null +++ b/modules/profiles/personal_contacts.nix @@ -0,0 +1,50 @@ +{ lib +, config +, pkgs +, ... +}: + +with lib; +let + cfg = config.my.profiles.personal; +in +{ + options.my.profiles.personal.contacts = mkEnableOption "contacts"; + + config = mkIf cfg.contacts { + home-manager.users.moritz = { + programs.khard.enable = true; + programs.vdirsyncer.enable = true; + services.vdirsyncer.enable = true; + programs.aerc.extraConfig.compose.address-book-cmd = "khard email --remove-first-line --parsable %s"; + accounts.contact = { + basePath = "Documents/Contacts"; + accounts.personal = { + local = { + type = "filesystem"; + fileExt = ".vcf"; + }; + remote = { + passwordCommand = [ "cat" "/run/agenix/nextcloud" ]; + url = "https://nextcloud.moritzboeh.me/remote.php/dav"; + type = "carddav"; + userName = "moritz"; + }; + khard.enable = true; + khard.defaultCollection = "contacts"; + vdirsyncer.enable = true; + vdirsyncer.collections = [ + # "z-app-generated--contactsinteraction--recent" # Recently contacted + # "z-server-generated--system" # Accounts + "contacts" # Contacts + ]; + vdirsyncer.conflictResolution = [ "vimdiff" ]; + }; + }; + }; + age.secrets.nextcloud = { + file = ../../secrets/nextcloud.age; + owner = "1000"; + }; + }; +} diff --git a/modules/profiles/personal_mail.nix b/modules/profiles/personal_mail.nix index 2aa559c..74f72b6 100644 --- a/modules/profiles/personal_mail.nix +++ b/modules/profiles/personal_mail.nix @@ -60,6 +60,8 @@ in realName = "Moritz Böhme"; mbsync.enable = true; mbsync.create = "both"; + mbsync.remove = "both"; + mbsync.expunge = "both"; passwordCommand = "${lib.getExe' pkgs.coreutils "cat"} /run/agenix/email"; }; accounts.email.maildirBasePath = "Documents/Mail"; diff --git a/secrets/nextcloud.age b/secrets/nextcloud.age new file mode 100644 index 0000000..168543e --- /dev/null +++ b/secrets/nextcloud.age @@ -0,0 +1,9 @@ +age-encryption.org/v1 +-> ssh-ed25519 CjuqfA QloWb6Q2yIcherp9k+O0A0uEO0rc8X3Kcldtt2HmQmQ +EQ2+UJx12ODOzDciyy4D8sFfd3ANkb8CqkEMkzhkH4c +-> ssh-ed25519 wG6LYg wZH/zMmCxvo/+OCm0WelbWc7iCilNQOKS8jFH2T/DQ0 +Yyaa55UpdM+VmtLHlLOL86ERaJorDVk9rgsD91kJyBM +-> ssh-ed25519 ZYd7Zg CypGom+Ot6b4naMAhFL3rNVHZHcQeHGQ+3LXPCIMYUQ +HrXypX9Zvvwu4c8N8cKftjAUyRfZdNacn3WeV0KKbY4 +--- O/DBTdosaXCPZK2a1oEbIeEv12uiJOJQ4LJrP+F+JhE +Õѳ…H1¤Œ³˜ãHhÉk¹œÐ/âívÂTÃâÍÝãÕ†©î>¡ÚÖšÏè‰ÄÚ '>zsù‹'çe¸…º \ No newline at end of file diff --git a/secrets/secrets.nix b/secrets/secrets.nix index e9337d1..9110d8f 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -30,4 +30,5 @@ in "anthropic.age".publicKeys = personal; "nix-github-token.age".publicKeys = personal; "email.age".publicKeys = personal; + "nextcloud.age".publicKeys = personal; }