Make more account activation dependency links

Link more calendar/contact accounts with relevant email
Link services to expressions required

Disable ukaea email by default, enable on work laptop
This commit is contained in:
Evie Litherland-Smith 2023-10-03 07:59:00 +01:00
parent b2a27457fe
commit 6c63148774
4 changed files with 80 additions and 83 deletions

View file

@ -8,14 +8,16 @@
services.vdirsyncer.enable = true; services.vdirsyncer.enable = true;
accounts.calendar = { accounts.calendar = {
basePath = ".calendar"; basePath = ".calendar";
accounts = { accounts = let
nextcloud = {
primary = lib.mkDefault true;
primaryCollection = "Personal";
local = { local = {
type = "filesystem"; type = "filesystem";
fileExt = ".ics"; fileExt = ".ics";
}; };
in {
nextcloud = rec {
inherit local;
primary = lib.mkDefault true;
primaryCollection = "Personal";
remote = { remote = {
type = "caldav"; type = "caldav";
url = "https://cloud.xenia.me.uk/remote.php/dav"; url = "https://cloud.xenia.me.uk/remote.php/dav";
@ -33,30 +35,27 @@
metadata = [ "color" "displayname" ]; metadata = [ "color" "displayname" ];
}; };
khal = { khal = {
enable = lib.mkDefault true; inherit (vdirsyncer) enable;
type = "discover"; type = "discover";
}; };
}; };
ukaea = { ukaea = let emailConfig = config.accounts.email.accounts.ukaea;
in rec {
inherit local;
primaryCollection = "Calendar"; primaryCollection = "Calendar";
local = {
type = "filesystem";
fileExt = ".ics";
};
remote = rec { remote = rec {
inherit (config.accounts.email.accounts.ukaea) inherit (emailConfig) userName passwordCommand;
userName passwordCommand;
type = "caldav"; type = "caldav";
url = "http://localhost:1080/users/${userName}/calendar/"; url = "http://localhost:1080/users/${userName}/calendar/";
}; };
vdirsyncer = { vdirsyncer = {
enable = lib.mkDefault true; enable = lib.mkDefault emailConfig.mbsync.enable;
collections = [ "from a" ]; collections = [ "from a" ];
metadata = [ "color" "displayname" ]; metadata = [ "color" "displayname" ];
itemTypes = [ "VEVENT" ]; itemTypes = [ "VEVENT" ];
}; };
khal = { khal = {
enable = lib.mkDefault true; inherit (vdirsyncer) enable;
type = "discover"; type = "discover";
}; };
}; };

View file

@ -5,37 +5,35 @@
programs.vdirsyncer.enable = true; programs.vdirsyncer.enable = true;
accounts.contact = { accounts.contact = {
basePath = ".contact"; basePath = ".contact";
accounts = { accounts = let
nextcloud = { calendarAccounts = config.accounts.calendar.accounts;
local = { local = {
type = "filesystem"; type = "filesystem";
fileExt = ".vcf"; fileExt = ".vcf";
}; };
in {
nextcloud = {
inherit local;
remote = { remote = {
inherit (config.accounts.calendar.accounts.nextcloud.remote) inherit (calendarAccounts.nextcloud.remote) userName passwordCommand;
userName passwordCommand;
type = "carddav"; type = "carddav";
url = url =
"https://cloud.xenia.me.uk/remote.php/dav/addressbooks/users/xenia/contacts-1/"; "https://cloud.xenia.me.uk/remote.php/dav/addressbooks/users/xenia/contacts-1/";
}; };
vdirsyncer = { vdirsyncer = {
enable = lib.mkDefault true; inherit (calendarAccounts.nextcloud.vdirsyncer) enable;
collections = [ "from a" ]; collections = [ "from a" ];
}; };
}; };
ukaea = { ukaea = {
local = { inherit local;
type = "filesystem";
fileExt = ".vcf";
};
remote = rec { remote = rec {
inherit (config.accounts.calendar.accounts.ukaea.remote) inherit (calendarAccounts.ukaea.remote) userName passwordCommand;
userName passwordCommand;
type = "carddav"; type = "carddav";
url = "http://localhost:1080/users/${userName}/contacts/"; url = "http://localhost:1080/users/${userName}/contacts/";
}; };
vdirsyncer = { vdirsyncer = {
enable = lib.mkDefault true; inherit (calendarAccounts.ukaea.vdirsyncer) enable;
collections = [ "from a" ]; collections = [ "from a" ];
}; };
}; };

View file

@ -107,7 +107,7 @@
ukaea = let ukaea = let
host = "127.0.0.1"; host = "127.0.0.1";
tls.enable = false; tls.enable = false;
accountEnabled = true; accountEnabled = false;
in rec { in rec {
inherit realName; inherit realName;
primary = lib.mkDefault false; primary = lib.mkDefault false;
@ -156,17 +156,17 @@
}; };
}; };
}; };
systemd.user.services = { systemd.user.services = let emailAccounts = config.accounts.email.accounts;
imapnotify-proton.Unit = { in {
imapnotify-proton.Unit = lib.mkIf emailAccounts.proton.imapnotify.enable {
Wants = [ "protonmail-bridge.service" ]; Wants = [ "protonmail-bridge.service" ];
After = [ "protonmail-bridge.service" ]; After = [ "protonmail-bridge.service" ];
}; };
imapnotify-ukaea.Unit = { imapnotify-ukaea.Unit = lib.mkIf emailAccounts.ukaea.imapnotify.enable {
Wants = [ "davmail.service" ]; Wants = [ "davmail.service" ];
After = [ "davmail.service" ]; After = [ "davmail.service" ];
}; };
protonmail-bridge = protonmail-bridge = lib.mkIf emailAccounts.proton.mbsync.enable {
lib.mkIf config.accounts.email.accounts.proton.mbsync.enable {
Unit = { Unit = {
Description = "Podman container-protonmail-bridge.service"; Description = "Podman container-protonmail-bridge.service";
Documentation = [ "man:podman-generate-systemd(1)" ]; Documentation = [ "man:podman-generate-systemd(1)" ];
@ -205,7 +205,7 @@
}; };
Install.WantedBy = [ "default.target" ]; Install.WantedBy = [ "default.target" ];
}; };
davmail = lib.mkIf config.accounts.email.accounts.ukaea.mbsync.enable { davmail = lib.mkIf emailAccounts.ukaea.mbsync.enable {
Unit = { Unit = {
Description = "Davmail server"; Description = "Davmail server";
Wants = [ "network-online.target" "graphical-session.target" ]; Wants = [ "network-online.target" "graphical-session.target" ];

View file

@ -24,15 +24,15 @@
accounts = { accounts = {
email.accounts = { email.accounts = {
proton.primary = false; proton.primary = false;
ukaea.primary = true; ukaea = {
primary = true;
imapnotify.enable = true;
mbsync.enable = true;
msmtp.enable = true;
mu.enable = true;
}; };
calendar.accounts.nextcloud = {
vdirsyncer.enable = false; # TEMP until fixed
khal.enable = false; # TEMP until fixed
};
contact.accounts.nextcloud = {
vdirsyncer.enable = false; # TEMP until fixed
}; };
calendar.accounts.nextcloud.vdirsyncer.enable = false; # TEMP until fixed
}; };
services.vdirsyncer.enable = lib.mkForce false; # TEMP until fixed services.vdirsyncer.enable = lib.mkForce false; # TEMP until fixed
services.kanshi.profiles = { services.kanshi.profiles = {