1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

emacs: respect defaultEditor on Darwin (#7063)

Currently on Darwin, services.emacs.defaultEditor = true isn't respected, as the variable is only configured on Linux.

This PR simply moves the variable out to a common block, so it's applied on all platforms.
This commit is contained in:
andre4ik3 2025-05-15 07:27:36 +04:00 committed by GitHub
parent 6bf057fc83
commit 02ea79853c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -120,6 +120,14 @@ in
config = mkIf cfg.enable ( config = mkIf cfg.enable (
lib.mkMerge [ lib.mkMerge [
{
home.sessionVariables = mkIf cfg.defaultEditor {
EDITOR = lib.getBin (
pkgs.writeShellScript "editor" ''exec ${lib.getBin cfg.package}/bin/emacsclient "''${@:---create-frame}"''
);
};
}
(mkIf pkgs.stdenv.isLinux { (mkIf pkgs.stdenv.isLinux {
systemd.user.services.emacs = systemd.user.services.emacs =
{ {
@ -179,15 +187,7 @@ in
}; };
}; };
home = { home.packages = optional cfg.client.enable (lib.hiPrio clientDesktopItem);
packages = optional cfg.client.enable (lib.hiPrio clientDesktopItem);
sessionVariables = mkIf cfg.defaultEditor {
EDITOR = lib.getBin (
pkgs.writeShellScript "editor" ''exec ${lib.getBin cfg.package}/bin/emacsclient "''${@:---create-frame}"''
);
};
};
}) })
(mkIf (cfg.socketActivation.enable && pkgs.stdenv.isLinux) { (mkIf (cfg.socketActivation.enable && pkgs.stdenv.isLinux) {