aboutsummaryrefslogtreecommitdiffstats
path: root/modules/home
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/home.legacy/conf/mail/default.nix32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/home.legacy/conf/mail/default.nix b/modules/home.legacy/conf/mail/default.nix
index 0ecbe40a..5e35c002 100644
--- a/modules/home.legacy/conf/mail/default.nix
+++ b/modules/home.legacy/conf/mail/default.nix
@@ -1,15 +1,47 @@
{
config,
pkgs,
+ lib,
...
}: let
benedikt = import ./accounts/benedikt.nix {inherit pkgs;};
soispha = import ./accounts/soispha.nix {inherit pkgs;};
accounts = {inherit soispha benedikt;};
+
+ mkHelper = {
+ userName,
+ passwordCommand,
+ ...
+ }:
+ builtins.toString (pkgs.writeShellScript "git-credential-keepassxc-libsecret"
+ # bash
+ ''
+ [ "$1" = "get" ] || {
+ exit 1
+ }
+ if cat | grep "username=${userName}" -q; then
+ ${passwordCommand}
+ else
+ # Not our business.
+ exit 1
+ fi
+ '');
+ accountCredentials =
+ # TODO: This will result in only one of them being defined, as we duplicate the
+ # attribute key<2025-02-03>
+ lib.mapAttrs' (_: value: {
+ name = "credential";
+ value = {
+ "smtp://${value.smtp.host}:${builtins.toString value.smtp.port}" = mkHelper value;
+ };
+ })
+ accounts;
in {
accounts.email = {
maildirBasePath = "${config.xdg.dataHome}/maildir";
inherit accounts;
};
+
+ programs.git.extraConfig = accountCredentials;
}