feat: add email integration with mu4e and protonmail-bridge

- Configure mu4e in Doom Emacs with Proton mail account
- Add protonmail-bridge service and mbsync/msmtp for mail sync
- Integrate sops-nix for secrets management (mail password)
- Create mail.nix with full IMAP/SMTP configuration
- Add ComfyUI user service module
- Add custom ASCII banner for Doom dashboard
- Enable nix module in Doom Emacs
- Add force-quit gnome extension
- Ignore secrets directory in git
- also add comfy-ui
This commit is contained in:
Thiago Sposito 2026-01-18 20:40:32 -03:00
parent 7f5ad94534
commit 0251529a8a
Signed by: thiago
GPG key ID: 3065EA73A976D430
14 changed files with 220 additions and 22 deletions

View file

@ -21,6 +21,8 @@
emacsPackages.vterm
emacsPackages.treemacs
emacsPackages.doom
emacsPackages.mu4e
mu
sbcl
];

View file

@ -0,0 +1,13 @@
█████████ ███ █████
███░░░░░███ ░░░ ░░███
░███ ░░░ ████████ ██████ █████ ████ ███████ ██████
░░█████████ ░░███░░███ ███░░███ ███░░ ░░███ ░░░███░ ███░░███
░░░░░░░░███ ░███ ░███░███ ░███░░█████ ░███ ░███ ░███ ░███
███ ░███ ░███ ░███░███ ░███ ░░░░███ ░███ ░███ ███░███ ░███
░░█████████ ░███████ ░░██████ ██████ █████ ██ ░░█████ ░░██████
░░░░░░░░░ ░███░░░ ░░░░░░ ░░░░░░ ░░░░░ ░░ ░░░░░ ░░░░░░
░███ ___ __ __ __ ___ __
█████ | __| V |/ \ / _//' _/
░░░░░ | _|| \_/ | /\ | \__`._`.
|___|_| |_|_||_|\__/|___/

View file

@ -1,7 +1,18 @@
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Add NixOS mu4e to load-path
(let ((mu4e-dir (car (file-expand-wildcards "~/.nix-profile/share/emacs/site-lisp/elpa/mu4e-*"))))
(when mu4e-dir
(add-to-list 'load-path mu4e-dir)))
(add-hook 'scheme-mode-hook #'smartparens-strict-mode)
(defun my-doom-ascii-banner ()
(let ((banner-file (expand-file-name "banner.txt" doom-user-dir)))
(when (file-exists-p banner-file)
(insert-file-contents banner-file))))
(setq +doom-dashboard-ascii-banner-fn #'my-doom-ascii-banner)
(use-package! lsp-mode
:config
(add-to-list 'lsp-language-id-configuration '(fennel-mode . "fennel"))
@ -45,3 +56,22 @@
(map! :desc "Toggle terminal (vterm)"
"C-~" #'vterm)
(after! mu4e
(setq mu4e-get-mail-command "mbsync -a"
mu4e-update-interval 300
mu4e-maildir "~/Maildir"
mu4e-change-filenames-when-moving t
sendmail-program "msmtp"
send-mail-function #'sendmail-send-it
message-sendmail-f-is-evil t
message-sendmail-extra-arguments '("--read-envelope-from")
message-send-mail-function #'message-send-mail-with-sendmail)
(set-email-account! "Proton"
'((mu4e-sent-folder . "/proton/Sent")
(mu4e-drafts-folder . "/proton/Drafts")
(mu4e-trash-folder . "/proton/Trash")
(mu4e-refile-folder . "/proton/Archive")
(user-mail-address . "th.spo@pm.me")
(user-full-name . "Thiago Sposito"))
t))

View file

@ -100,7 +100,7 @@
(eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation
llm ; when I said you needed friends, I didn't mean...
(lsp +peek)
lsp
;;(lsp +eglot) ; M-x vscode
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
@ -111,8 +111,8 @@
tree-sitter ; syntax and parsing, sitting in a tree...
upload ; map local to remote projects via ssh/ftp
:os
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
; :os
;(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
:lang
@ -156,7 +156,7 @@
(lua +fennel +lsp) ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
org ; organize your plain life in plain text
;;php ; perl's insecure younger brother
@ -183,11 +183,12 @@
;;zig ; C, but simpler
:email
;;(mu4e +org +gmail)
(mu4e +mbsync +org)
;;notmuch
;;(wanderlust +gmail)
:app:
:app
;;calendar
;;emms
;;everywhere ; *leave* Emacs!? You must be joking

View file

@ -30,6 +30,7 @@
home.packages = with pkgs; [
gnome-tweaks
gnomeExtensions.appindicator
gnomeExtensions.force-quit
gnomeExtensions.forge
gnomeExtensions.gsconnect
gnomeExtensions.pop-shell

View file

@ -2,6 +2,7 @@
pkgs,
lib,
inputs,
sops,
...
}:
let
@ -25,7 +26,9 @@ in
./gnome
./icons.nix
./nvim
./services
./zsh.nix
./mail.nix
];
nixpkgs = {
@ -77,6 +80,7 @@ in
pandoc
pinentry-curses
podman
protonmail-bridge
python3
racket
ripgrep
@ -163,19 +167,34 @@ in
background_opacity = 1.0;
};
};
mbsync.enable = true;
vscode = {
enable = true;
};
};
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
pinentry.package = pkgs.pinentry-curses;
};
services = {
#systemd.user.startServices = "sd-switch";
gpg-agent = {
enable = true;
enableZshIntegration = true;
pinentry.package = pkgs.pinentry-curses;
};
protonmail-bridge = {
enable = true;
extraPackages = [
pkgs.gnome-keyring
];
};
};
sops = {
gnupg.home = "/home/thiago/.gnupg";
age.keyFile = null; # We are using the Nitrokey (PGP) instead
};
#systemd.user.startServices = "sd-switch";
home.stateVersion = "25.11";
# sops configuration

58
home-manager/mail.nix Normal file
View file

@ -0,0 +1,58 @@
{
pkgs,
config,
sops,
secrets,
...
}:
{
sops.secrets = {
"mailpass" = {
sopsFile = secrets.outPath + "/mail.yaml";
key = "password";
};
};
accounts.email.accounts.proton = {
primary = true;
address = "th.spo@pm.me";
userName = "thiago@sposito.ch";
realName = "Thiago Sposito";
passwordCommand = "${pkgs.coreutils}/bin/cat ${config.sops.secrets.mailpass.path}";
imap = {
host = "127.0.0.1";
port = 1143;
tls.enable = true;
};
smtp = {
host = "127.0.0.1";
port = 1025;
tls.enable = true;
};
mbsync = {
enable = true;
create = "maildir";
expunge = "both";
extraConfig.account = {
SSLType = "STARTTLS";
TLSType = "STARTTLS";
CertificateFile = "~/.config/protonmail/bridge-v3/cert.pem";
AuthMechs = "LOGIN";
};
};
msmtp = {
enable = true;
extraConfig = {
tls_starttls = "on";
tls_certcheck = "off";
};
};
};
programs.mbsync.enable = true;
programs.msmtp.enable = true;
programs.mu.enable = true;
}

View file

@ -0,0 +1,61 @@
{ pkgs, config, lib, ... }:
let
comfyuiSrc = pkgs.fetchFromGitHub {
owner = "Comfy-Org";
repo = "ComfyUI";
rev = "master";
sha256 = "PQfZ0PD/PQn49ElGdzt/El8JrU7clETcLi/6ZUxm8f8=";
};
dataDir = "${config.home.homeDirectory}/.local/share/comfyui";
venvDir = "${dataDir}/.venv";
startScript = pkgs.writeShellScript "comfyui-start" ''
set -e
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib:${pkgs.libGL}/lib:/run/opengl-driver/lib:$LD_LIBRARY_PATH"
mkdir -p ${dataDir}
# Copy source if not exists or update
if [ ! -f "${dataDir}/main.py" ]; then
cp -r ${comfyuiSrc}/* ${dataDir}/
chmod -R u+w ${dataDir}
fi
cd ${dataDir}
# Create venv on first run
if [ ! -d "${venvDir}" ]; then
${pkgs.python313}/bin/python -m venv ${venvDir}
${venvDir}/bin/pip install --upgrade pip
fi
# Always ensure deps are installed
if [ ! -f "${venvDir}/.deps-installed" ]; then
${venvDir}/bin/pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu124
${venvDir}/bin/pip install -r requirements.txt
touch ${venvDir}/.deps-installed
fi
exec ${venvDir}/bin/python main.py "$@"
'';
in
{
home.packages = [ pkgs.python313 pkgs.git ];
systemd.user.services.comfy-ui = {
Unit = {
Description = "ComfyUI";
After = [ "network.target" ];
};
Service = {
Type = "simple";
ExecStart = "${startScript}";
Restart = "on-failure";
Environment = [ "CUDA_VISIBLE_DEVICES=0" ];
};
Install.WantedBy = [ "default.target" ];
};
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
imports = [
./comfy-ui.nix
];
}