From 9ce0fac4e90423c719ce65dc3c4dc5a83b434ad3 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 8 Oct 2023 09:49:07 +0100 Subject: [PATCH] davmail service now copies properties file if it doesn't exist already --- Makefile | 10 +---- .../accounts/.davmail.properties | 43 ++++--------------- home/accounts/email.nix | 8 +++- 3 files changed, 16 insertions(+), 45 deletions(-) rename .davmail.properties => home/accounts/.davmail.properties (63%) diff --git a/Makefile b/Makefile index c1009476..af3c40e2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: test build mu all +.PHONY: test build mu test: sudo nixos-rebuild test --flake . @@ -14,11 +14,3 @@ mu: --my-address=e.litherlandsmith@icloud.com \ --my-address=evie.litherland-smith@ukaea.uk \ --my-address=elitherl@jet.uk - -.davmail.properties: - touch $@ - -~/.davmail.properties: .davmail.properties - cp $? $@ - -all: mu ~/.davmail.properties diff --git a/.davmail.properties b/home/accounts/.davmail.properties similarity index 63% rename from .davmail.properties rename to home/accounts/.davmail.properties index 000fa5c5..f32d4936 100644 --- a/.davmail.properties +++ b/home/accounts/.davmail.properties @@ -1,66 +1,39 @@ -davmail.ssl.keystoreType= -davmail.ssl.keystorePass= -davmail.proxyPassword= -davmail.oauth.tenantId= -davmail.oauth.clientId= +davmail.server=true +davmail.mode=O365Interactive +davmail.url=https://outlook.office365.com/EWS/Exchange.asmx +davmail.imapPort=1144 davmail.smtpPort=1026 +davmail.caldavPort=1080 +davmail.enableKeepAlive=true +davmail.logFilePath=/tmp/davmail.log davmail.enableKerberos=false -davmail.folderSizeLimit= davmail.forceActiveSyncUpdate=false davmail.imapAutoExpunge=true davmail.useSystemProxies=false -davmail.proxyUser= davmail.caldavEditNotifications=false davmail.ssl.nosecuresmtp=false davmail.caldavPastDelay=0 -davmail.ssl.keyPass= log4j.logger.httpclient.wire=WARN -davmail.noProxyFor= -davmail.server=true davmail.popMarkReadOnRetr=false davmail.ssl.nosecureimap=false davmail.disableTrayActivitySwitch=true davmail.caldavAutoSchedule=true davmail.enableProxy=false -davmail.proxyPort= -davmail.logFileSize= -davmail.mode=O365Interactive -davmail.smtpSaveInSent=true -davmail.bindAddress= +davmail.smtpSaveInSent=false davmail.ssl.nosecurepop=false -davmail.ssl.pkcs11Library= log4j.rootLogger=WARN -davmail.ssl.keystoreFile= log4j.logger.davmail=DEBUG -davmail.ssl.clientKeystoreType= -davmail.clientSoTimeout= -davmail.ssl.pkcs11Config= -davmail.imapPort=1144 davmail.ssl.clientKeystorePass= -davmail.url=https://outlook.office365.com/EWS/Exchange.asmx log4j.logger.org.apache.http.conn.ssl=WARN davmail.sentKeepDelay=0 davmail.ssl.nosecureldap=false davmail.imapAlwaysApproxMsgSize=true davmail.ssl.nosecurecaldav=false -davmail.popPort= -davmail.defaultDomain= davmail.showStartupBanner=false log4j.logger.httpclient=WARN -davmail.proxyHost= -davmail.ldapPort= -davmail.server.certificate.hash= log4j.logger.org.apache.http.wire=WARN davmail.disableGuiNotifications=true -davmail.imapIdleDelay= -davmail.allowRemote=false davmail.disableUpdateCheck=true log4j.logger.org.apache.http=WARN -davmail.caldavPort=1080 -davmail.enableKeepAlive=true -davmail.ssl.clientKeystoreFile= -davmail.logFilePath=/tmp/davmail.log davmail.carddavReadPhoto=true davmail.keepDelay=30 -davmail.oauth.redirectUri= -davmail.caldavAlarmSound= diff --git a/home/accounts/email.nix b/home/accounts/email.nix index a0e02b44..bef54d3a 100644 --- a/home/accounts/email.nix +++ b/home/accounts/email.nix @@ -217,7 +217,13 @@ Service = { Environment = [ "PATH=/run/current-system/sw/bin/:$PATH" ]; Restart = "always"; - ExecStart = "${pkgs.davmail}/bin/davmail -notray"; + ExecStartPre = with config.home; '' + /bin/sh -c "if [ ! -f ${homeDirectory}/.davmail.properties ]; then cp ${ + ./.davmail.properties + } ${homeDirectory}/.davmail.properties; fi" + ''; + ExecStart = + "${pkgs.davmail}/bin/davmail -notray ${config.home.homeDirectory}/.davmail.properties"; }; Install.WantedBy = [ "default.target" ]; };