From dae3149a93cab4d1140526e15eb928d275f56128 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Fri, 7 Apr 2023 19:35:15 +0300 Subject: 2023-04-07 --- modules/common/profiles/email.nix | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'modules/common/profiles') 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; + }; }; }; }; -- cgit v1.2.3