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 secret-tool store --label="iCloud mail mbsync" email e.litherlandsmith@icloud.com
#+end_src #+end_src
** UKAEA ** 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 *** Password
Register app-password with gnome-keyring: Register app-password with gnome-keyring:
#+begin_src bash #+begin_src bash
secret-tool store --label="UKAEA mail mbsync" email evie.litherland-smith@ukaea.uk secret-tool store --label="UKAEA mail mbsync" email evie.litherland-smith@ukaea.uk
#+end_src #+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 * Vdirsyncer
** Password ** Password
Register app-password with gnome-keyring; Register app-password with gnome-keyring;

View file

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

View file

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