about summary refs log tree commit diff
path: root/modules/common/profiles/email.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/common/profiles/email.nix')
-rw-r--r--modules/common/profiles/email.nix22
1 files changed, 19 insertions, 3 deletions
diff --git a/modules/common/profiles/email.nix b/modules/common/profiles/email.nix
index e289c2e..9cc12d7 100644
--- a/modules/common/profiles/email.nix
+++ b/modules/common/profiles/email.nix
@@ -39,7 +39,18 @@ in {
               attrs
             ];
 
-          pass = path: "${config.hm.programs.password-store.package}/bin/pass show ${path}";
+          getPassword = {
+            path,
+            line ? 0,
+          }:
+            assert (builtins.isInt line);
+              concatStringsSep " " (
+                [
+                  "${config.hm.programs.password-store.package}/bin/pass show ${path}"
+                ]
+                ++ optional (line > 0)
+                "| ${pkgs.gnused}/bin/sed -e '${toString line}!d'"
+              );
         in rec {
           shire = mkAccount rec {
             address = my.email;
@@ -64,7 +75,9 @@ in {
               tls.enable = true;
             };
             userName = "azahi@shire.net";
-            passwordCommand = pass "email/shire.net/azahi";
+            passwordCommand = getPassword {
+              path = "email/shire.net/azahi";
+            };
           };
 
           yahoo = mkAccount rec {
@@ -74,7 +87,10 @@ in {
 
             flavor = "yahoo.com";
             userName = "admin@yahoo.com";
-            passwordCommand = pass "email/yahoo.com/admin";
+            passwordCommand = getPassword {
+              path = "email/yahoo.com/admin";
+              line = 2;
+            };
           };
         };
       };

Consider giving Nix/NixOS a try! <3