about summary refs log tree commit diff stats
path: root/modules/home.legacy/conf/mail/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/home.legacy/conf/mail/default.nix12
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/home.legacy/conf/mail/default.nix b/modules/home.legacy/conf/mail/default.nix
index 9c2554ee..46526173 100644
--- a/modules/home.legacy/conf/mail/default.nix
+++ b/modules/home.legacy/conf/mail/default.nix
@@ -20,8 +20,14 @@
         [ "$1" = "get" ] || {
           exit 1
         }
-        if cat | grep "username=${userName}" -q; then
-          ${passwordCommand}
+        output="$(cat)"
+        if echo "$output" | grep "username=${userName}" -q; then
+          if password="$(${passwordCommand})"; then
+            printf "%s\npassword=%s\n\n" "$output" "$password"
+          else
+            # The password command failed (for whatever reason)
+            exit 1
+          fi
         else
           # Not our business.
           exit 1
@@ -29,7 +35,7 @@
       '');
   accountCredentials =
     # TODO: This will result in only one of them being defined, as we duplicate the
-    # attribute key<2025-02-03>
+    # attribute key <2025-02-03>
     lib.mapAttrs' (_: value: {
       name = "credential.smtp://${value.smtp.host}:${builtins.toString value.smtp.port}";
       value = {