Davmail service uses package directly instead of container

This commit is contained in:
Evie Litherland-Smith 2023-10-02 16:58:54 +01:00
parent 5088141397
commit 95b1dc038e
3 changed files with 12 additions and 41 deletions

View file

@ -31,19 +31,17 @@ Register app-password with gnome-keyring:
secret-tool store --label="iCloud mail mbsync" email e.litherlandsmith@icloud.com
#+end_src
** UKAEA
*** Davmail
Docker source: [[https://hub.docker.com/r/connectical/davmail/][Docker]]
No setup needed but initial pull may take a while, if systemd unit times out run:
#+begin_src bash
podman run --rm -d --name=davmail -p 127.0.0.1:1026:1025 -p 127.0.0.1:1144:1143 -p 127.0.0.1:1080:1080 connectical/davmail
#+end_src
and subsequent systemd runs should start fine.
*** Password
Register app-password with gnome-keyring:
#+begin_src bash
secret-tool store --label="UKAEA mail mbsync" email evie.litherland-smith@ukaea.uk
#+end_src
*** Configuration
Example .davmail.properties needs copying to home directory, make rule can handle this.
Will need to restart systemd service after copying to pick up new settings
#+begin_src bash
systemctl --user restart davmail.service
#+end_src
* Vdirsyncer
** Password
Register app-password with gnome-keyring;

View file

@ -207,41 +207,14 @@
};
davmail = lib.mkIf config.accounts.email.accounts.ukaea.mbsync.enable {
Unit = {
Description = "Podman container-davmail.service";
Documentation = [ "man:podman-generate-systemd(1)" ];
Wants = [ "network-online.target" ];
After = [ "network-online.target" ];
RequiresMountsFor = "%t/containers";
Description = "Davmail server";
Wants = [ "network-online.target" "graphical-session.target" ];
After = [ "network-online.target" "graphical-session.target" ];
};
Service = {
Environment =
[ "PODMAN_SYSTEMD_UNIT=%n" "PATH=/run/wrappers/bin/:$PATH" ];
Environment = [ "PATH=/run/current-system/sw/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=davmail \
-p 127.0.0.1:1026:1025 \
-p 127.0.0.1:1144:1143 \
-p 127.0.0.1:1080:1080 connectical/davmail
'';
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";
ExecStart = "${pkgs.davmail}/bin/davmail -notray";
};
Install.WantedBy = [ "default.target" ];
};

View file

@ -1,7 +1,7 @@
{ config, pkgs, lib, user, ... }:
{
home.packages = with pkgs; [ davmail openfortivpn nomachine-client ];
home.packages = with pkgs; [ openfortivpn nomachine-client ];
programs = {
git.userEmail = "evie.litherland-smith@ukaea.uk";
ssh.matchBlocks = {