change from mono-home-manager to full flake multi-system configuration
This commit is contained in:
72
home/mail.nix
Normal file
72
home/mail.nix
Normal file
@@ -0,0 +1,72 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
bridgeAppImage = pkgs.appimageTools.wrapType2 {
|
||||
pname = "protonmail-bridge";
|
||||
version = "3.8.0-beta.1";
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://proton.me/download/bridge/protonmail-bridge-3.8.0-beta.1-linux.AppImage";
|
||||
sha256 = "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=";
|
||||
};
|
||||
};
|
||||
|
||||
wrapperScript = pkgs.writeShellScriptBin "thunderbird" ''
|
||||
if ! pgrep -x "protonmail-bridge" > /dev/null; then
|
||||
systemctl --user start protonmail-bridge.service
|
||||
sleep 2 # Wait briefly to ensure bridge is ready
|
||||
fi
|
||||
exec ${pkgs.thunderbird}/bin/thunderbird "$@"
|
||||
'';
|
||||
cfg = config.homeModules.mail;
|
||||
in
|
||||
|
||||
lib.mkIf cfg.enable {
|
||||
home.packages = [
|
||||
bridgeAppImage
|
||||
wrapperScript
|
||||
];
|
||||
|
||||
# Start ProtonMail Bridge as systemd service
|
||||
systemd.user.services.protonmail-bridge = {
|
||||
Unit = {
|
||||
Description = "ProtonMail Bridge (headless)";
|
||||
After = [ "network.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${bridgeAppImage}/bin/protonmail-bridge --no-window";
|
||||
Restart = "on-failure";
|
||||
Environment = "PATH=${lib.makeBinPath [ pkgs.glibc pkgs.coreutils pkgs.bash ]}";
|
||||
};
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
|
||||
# Preconfigure Thunderbird profile (adjust email as needed)
|
||||
home.file.".thunderbird/profiles.ini".text = ''
|
||||
[Install4F96D1932C2A4F9B]
|
||||
Default=default
|
||||
Locked=1
|
||||
|
||||
[Profile0]
|
||||
Name=default
|
||||
IsRelative=1
|
||||
Path=default
|
||||
Default=1
|
||||
'';
|
||||
|
||||
home.file.".thunderbird/default/prefs.js".text = ''
|
||||
user_pref("mail.identity.id1.fullName", "Your Name");
|
||||
user_pref("mail.identity.id1.useremail", "your-email@protonmail.com");
|
||||
user_pref("mail.identity.id1.smtpServer", "smtp1");
|
||||
user_pref("mail.identity.id1.archive_folder", "imap://your-email@protonmail.com/Archives");
|
||||
user_pref("mail.account.account1.server", "imap1");
|
||||
user_pref("mail.account.account1.identities", "id1");
|
||||
user_pref("mail.server.imap1.hostname", "127.0.0.1");
|
||||
user_pref("mail.server.imap1.port", 1143);
|
||||
user_pref("mail.server.imap1.type", "imap");
|
||||
user_pref("mail.server.imap1.userName", "your-email@protonmail.com");
|
||||
user_pref("mail.smtpserver.smtp1.hostname", "127.0.0.1");
|
||||
user_pref("mail.smtpserver.smtp1.port", 1025);
|
||||
user_pref("mail.smtpserver.smtp1.authMethod", 3);
|
||||
user_pref("mail.smtpserver.smtp1.username", "your-email@protonmail.com");
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user