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 = { local = {
type = "filesystem";
fileExt = ".ics";
};
in {
nextcloud = rec {
inherit local;
primary = lib.mkDefault true; primary = lib.mkDefault true;
primaryCollection = "Personal"; primaryCollection = "Personal";
local = {
type = "filesystem";
fileExt = ".ics";
};
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
calendarAccounts = config.accounts.calendar.accounts;
local = {
type = "filesystem";
fileExt = ".vcf";
};
in {
nextcloud = { nextcloud = {
local = { inherit local;
type = "filesystem";
fileExt = ".vcf";
};
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,56 +156,56 @@
}; };
}; };
}; };
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)" ]; Wants = [ "network-online.target" ];
Wants = [ "network-online.target" ]; After = [ "network-online.target" ];
After = [ "network-online.target" ]; RequiresMountsFor = "%t/containers";
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" ];
}; };
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 = { 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;
calendar.accounts.nextcloud = { imapnotify.enable = true;
vdirsyncer.enable = false; # TEMP until fixed mbsync.enable = true;
khal.enable = false; # TEMP until fixed msmtp.enable = true;
}; mu.enable = true;
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 = {