Skip to content

Commit

Permalink
Setup himalaya [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
asciimoth committed Aug 6, 2023
1 parent 367b08a commit fffb12c
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
5 changes: 5 additions & 0 deletions machines/pcLexell/constants.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
ConfigRoot = "/etc/infrastructure";
MainUser = "moth";
Editor = "micro";
Email = "[email protected]";
Nicknames = {
Full = "ASCII Moth";
Lower = "asciimoth";
};
}
#let
# ConfigRoot = "/etc/infrastructure";
Expand Down
52 changes: 51 additions & 1 deletion machines/pcLexell/email.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,61 @@
...
}: let
constants = import ./constants.nix;
ors = pkgs.writeShellScriptBin "OR" ''
# Return output of first command with non empty stdout
# Usage:
# OR COMMAND1 COMMAND2 COMMANDN
for ___CMD in "$@"
do
RESULT=$(eval $___CMD)
if [ -n "$RESULT" ]; then
echo "$RESULT"
exit 0
fi
done
'';
in {
home-manager.users."${constants.MainUser}".programs = {
himalaya = {
enable = true;
settings = {};
settings = let
maildir = "/home/${constants.MainUser}/.mail";
in {
email-listing-page-size = 0;
"${constants.Nicknames.Full}" = let
login = "${constants.Nicknames.Lower}";
host = "disroot.org";
passcmd = ''OR "echo \$ASCIIMOTH_PASSWORD" "pass show email/disroot.org/asciimoth | head -1 | cut -d' ' -f2"'';
in {
email = "${constants.Email}";
default = true;
sync = true;
sync-dir = "${maildir}/${host}/${login}";
sync-folders-strategy.exclude = ["Junk" "Trash"];
# Backend
backend = "imap";
imap-host = "${host}";
imap-port = 993;
imap-login = "${login}@${host}";
imap-auth = "passwd";
imap-passwd = {
cmd = passcmd;
};
imap-ssl = true;
imap-starttls = false;
# Sender
sender = "smtp";
smtp-host = "${host}";
smtp-port = 465;
smtp-login = "${login}@${host}";
smtp-auth = "passwd";
smtp-passwd = {
cmd = ["pass show email/${host}/${login}" "head -1" "cut -d' ' -f2"];
};
smtp-ssl = true;
smtp-starttls = false;
};
};
};
thunderbird = {
enable = true;
Expand Down
14 changes: 14 additions & 0 deletions machines/pcLexell/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@
decolor = pkgs.writeShellScriptBin "decolor" ''
cat /dev/stdin | sed -r "s/\x1B\[[0-9;]*[JKmsu]//g"
'';
ors = pkgs.writeShellScriptBin "OR" ''
# Return output of first command with non empty stdout
# Usage:
# OR COMMAND1 COMMAND2 COMMANDN
for ___CMD in "$@"
do
RESULT=$(eval $___CMD)
if [ -n "$RESULT" ]; then
echo "$RESULT"
exit 0
fi
done
'';
read-or-value = pkgs.writeShellScriptBin "read-or-value" ''
RET=$(cat $1 2> /dev/null)
STATUS=$?
Expand Down Expand Up @@ -196,6 +209,7 @@ in {
num-max
num-min
num-lim
ors
read-or-value
withdir
clone-commit
Expand Down

0 comments on commit fffb12c

Please sign in to comment.