aboutsummaryrefslogtreecommitdiffstats
path: root/tests/by-name/st/stalwart-email-dns/nodes/user.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tests/by-name/st/stalwart-email-dns/nodes/user.nix')
-rw-r--r--tests/by-name/st/stalwart-email-dns/nodes/user.nix70
1 files changed, 70 insertions, 0 deletions
diff --git a/tests/by-name/st/stalwart-email-dns/nodes/user.nix b/tests/by-name/st/stalwart-email-dns/nodes/user.nix
new file mode 100644
index 0000000..fba02ce
--- /dev/null
+++ b/tests/by-name/st/stalwart-email-dns/nodes/user.nix
@@ -0,0 +1,70 @@
+{
+ pkgs,
+ vhackPackages,
+}: {
+ mkUser = user: serverName: {
+ nodes,
+ lib,
+ ...
+ }: {
+ imports = [
+ ../../../../common/acme/client.nix
+ ../../../../common/dns/client.nix
+ ];
+
+ environment.systemPackages = [
+ vhackPackages.fetchmail-common-name
+ pkgs.msmtp
+ pkgs.procmail
+
+ pkgs.bind
+ pkgs.openssl
+ ];
+
+ users.users."${user}" = {isNormalUser = true;};
+
+ systemd.tmpfiles.rules = [
+ "d /home/${user}/mail 0700 ${user} users - -"
+ "L /home/${user}/.fetchmailrc - - - - /etc/homeSetup/.fetchmailrc"
+ "L /home/${user}/.procmailrc - - - - /etc/homeSetup/.procmailrc"
+ "L /home/${user}/.msmtprc - - - - /etc/homeSetup/.msmtprc"
+ ];
+
+ environment.etc = {
+ "homeSetup/.fetchmailrc" = {
+ text = ''
+ poll "${serverName}.server.com" protocol IMAP
+ username "${user}"
+ password "${user}-password"
+ ssl
+ mda procmail;
+ '';
+ mode = "0600";
+ inherit user;
+ };
+ "homeSetup/.procmailrc" = {
+ text = ''
+ DEFAULT=$HOME/mail
+ '';
+ mode = "0600";
+ inherit user;
+ };
+ "homeSetup/.msmtprc" = {
+ text = ''
+ account ${user}
+ host ${serverName}.server.com
+ domain ${user}.com
+ port 465
+ from ${user}@${user}.com
+ user ${user}
+ password ${user}-password
+ auth on
+ tls on
+ tls_starttls off
+ '';
+ mode = "0600";
+ inherit user;
+ };
+ };
+ };
+}