1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-15 13:31:07 +01:00

emacs: add darwin service

This commit is contained in:
klchen0112 2024-11-22 23:35:22 +08:00 committed by Robert Helgesson
parent 16fe78182e
commit ba9367b5a9
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
5 changed files with 65 additions and 9 deletions

View file

@ -41,7 +41,6 @@ let
# to work without wrapping it.
socketDir = "%t/emacs";
socketPath = "${socketDir}/server";
in {
meta.maintainers = [ maintainers.tadfisher ];
@ -112,12 +111,7 @@ in {
};
config = mkIf cfg.enable (mkMerge [
{
assertions = [
(lib.hm.assertions.assertPlatform "services.emacs" pkgs
lib.platforms.linux)
];
(mkIf pkgs.stdenv.isLinux {
systemd.user.services.emacs = {
Unit = {
Description = "Emacs text editor";
@ -190,9 +184,9 @@ in {
}/bin/emacsclient "''${@:---create-frame}"'');
};
};
}
})
(mkIf cfg.socketActivation.enable {
(mkIf (cfg.socketActivation.enable && pkgs.stdenv.isLinux) {
systemd.user.sockets.emacs = {
Unit = {
Description = "Emacs text editor";
@ -222,5 +216,20 @@ in {
};
};
})
(mkIf pkgs.stdenv.isDarwin {
launchd.agents.emacs = {
enable = true;
config = {
ProgramArguments = [ "${cfg.package}/bin/emacs" "--fg-daemon" ]
++ cfg.extraOptions;
RunAtLoad = true;
KeepAlive = {
Crashed = true;
SuccessfulExit = false;
};
};
};
})
]);
}