Skip to content

Commit

Permalink
feat(thunderbird): created headless service
Browse files Browse the repository at this point in the history
Headless service can synchronize mails and calendar even client is
closed
  • Loading branch information
Wittano committed Jan 6, 2025
1 parent 8e09e35 commit 578e719
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
1 change: 1 addition & 0 deletions home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
./rofi.nix
./tmux.nix
./stalonetray.nix
./thunderbird.nix
];
}
40 changes: 40 additions & 0 deletions home-manager/thunderbird.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
serviceName = "thunderbird-headless";

thunderbird = pkgs.thunderbird.overrideAttrs (attrs: {
desktopItem = attrs.desktopItem.override (old: {
exec = pkgs.writeShellScript "thunderbird-wrapper" ''
${pkgs.systemd}/bin/systemctl --user stop ${serviceName}
${old.exec}
'';
});
});
in
{
options.programs.thunderbird.wittano.enable = mkEnableOption "thunderbird";
config = mkIf config.programs.thunderbird.wittano.enable {
home.packages = [ thunderbird ];

systemd.user = rec {
services.${serviceName} = {
Unit = {
Description = "Thunderbird in headless mode";
After = [ "network.target" ];
};

Service = {
ExecStart = "${thunderbird}/bin/thunderbird --headless";
ExecCondition = "${pkgs.bash}/bin/bash -c '! ${pkgs.toybox}/bin/pgrep thunderbird'";
};
};
timers.${serviceName} = {
inherit (services.${serviceName}) Unit;

Timer.OnCalendar = "*-*-* *:*:00";
};
};

};
}
2 changes: 1 addition & 1 deletion hosts/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let
home.stateVersion = systemVersion;

programs = {
thunderbird.wittano.enable = true;
mpv.enable = true;
btop.enable = true;
nitrogen.wittano.enable = true;
Expand Down Expand Up @@ -97,7 +98,6 @@ let
vivaldi

# Utils
thunderbird # Mail
eog # Image viewer
onlyoffice-bin # Office staff
nemo
Expand Down

0 comments on commit 578e719

Please sign in to comment.