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

View file

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

View file

@ -107,7 +107,7 @@
ukaea = let
host = "127.0.0.1";
tls.enable = false;
accountEnabled = true;
accountEnabled = false;
in rec {
inherit realName;
primary = lib.mkDefault false;
@ -156,56 +156,56 @@
};
};
};
systemd.user.services = {
imapnotify-proton.Unit = {
systemd.user.services = let emailAccounts = config.accounts.email.accounts;
in {
imapnotify-proton.Unit = lib.mkIf emailAccounts.proton.imapnotify.enable {
Wants = [ "protonmail-bridge.service" ];
After = [ "protonmail-bridge.service" ];
};
imapnotify-ukaea.Unit = {
imapnotify-ukaea.Unit = lib.mkIf emailAccounts.ukaea.imapnotify.enable {
Wants = [ "davmail.service" ];
After = [ "davmail.service" ];
};
protonmail-bridge =
lib.mkIf config.accounts.email.accounts.proton.mbsync.enable {
Unit = {
Description = "Podman container-protonmail-bridge.service";
Documentation = [ "man:podman-generate-systemd(1)" ];
Wants = [ "network-online.target" ];
After = [ "network-online.target" ];
RequiresMountsFor = "%t/containers";
};
Service = {
Environment =
[ "PODMAN_SYSTEMD_UNIT=%n" "PATH=/run/wrappers/bin/:$PATH" ];
Restart = "always";
TimeoutStopSec = 70;
ExecStart = ''
${pkgs.podman}/bin/podman run \
--cidfile=%t/%n.ctr-id \
--cgroups=no-conmon \
--rm \
--sdnotify=conmon \
--replace \
-d \
--name=protonmail-bridge \
-v protonmail:/root \
-p 127.0.0.1:1025:25/tcp \
-p 127.0.0.1:1143:143/tcp shenxn/protonmail-bridge'';
ExecStop = ''
${pkgs.podman}/bin/podman stop \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id'';
ExecStopPost = ''
${pkgs.podman}/bin/podman rm \
-f \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id'';
Type = "notify";
NotifyAccess = "all";
};
Install.WantedBy = [ "default.target" ];
protonmail-bridge = lib.mkIf emailAccounts.proton.mbsync.enable {
Unit = {
Description = "Podman container-protonmail-bridge.service";
Documentation = [ "man:podman-generate-systemd(1)" ];
Wants = [ "network-online.target" ];
After = [ "network-online.target" ];
RequiresMountsFor = "%t/containers";
};
davmail = lib.mkIf config.accounts.email.accounts.ukaea.mbsync.enable {
Service = {
Environment =
[ "PODMAN_SYSTEMD_UNIT=%n" "PATH=/run/wrappers/bin/:$PATH" ];
Restart = "always";
TimeoutStopSec = 70;
ExecStart = ''
${pkgs.podman}/bin/podman run \
--cidfile=%t/%n.ctr-id \
--cgroups=no-conmon \
--rm \
--sdnotify=conmon \
--replace \
-d \
--name=protonmail-bridge \
-v protonmail:/root \
-p 127.0.0.1:1025:25/tcp \
-p 127.0.0.1:1143:143/tcp shenxn/protonmail-bridge'';
ExecStop = ''
${pkgs.podman}/bin/podman stop \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id'';
ExecStopPost = ''
${pkgs.podman}/bin/podman rm \
-f \
--ignore -t 10 \
--cidfile=%t/%n.ctr-id'';
Type = "notify";
NotifyAccess = "all";
};
Install.WantedBy = [ "default.target" ];
};
davmail = lib.mkIf emailAccounts.ukaea.mbsync.enable {
Unit = {
Description = "Davmail server";
Wants = [ "network-online.target" "graphical-session.target" ];

View file

@ -24,15 +24,15 @@
accounts = {
email.accounts = {
proton.primary = false;
ukaea.primary = 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
ukaea = {
primary = true;
imapnotify.enable = true;
mbsync.enable = true;
msmtp.enable = true;
mu.enable = true;
};
};
calendar.accounts.nextcloud.vdirsyncer.enable = false; # TEMP until fixed
};
services.vdirsyncer.enable = lib.mkForce false; # TEMP until fixed
services.kanshi.profiles = {