Skip to content

Commit

Permalink
emacs: add proFileDirectory to daemon PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
klchen0112 committed Nov 26, 2024
1 parent a995363 commit e87a088
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 3 additions & 4 deletions modules/services/emacs.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }:

with lib;

let

cfg = config.services.emacs;
emacsCfg = config.programs.emacs;
emacsBinPath = "${cfg.package}/bin";
Expand Down Expand Up @@ -221,8 +218,10 @@ in {
launchd.agents.emacs = {
enable = true;
config = {
ProgramArguments = [ "${cfg.package}/bin/emacs" "--fg-daemon" ]
ProgramArguments = [ "${emacsBinPath}/emacs" "--fg-daemon" ]
++ cfg.extraOptions;
EnvironmentVariables.PATH =
"${config.home.profileDirectory}/bin:/usr/bin:/bin:/usr/sbin:/sbin";
RunAtLoad = true;
KeepAlive = {
Crashed = true;
Expand Down
4 changes: 1 addition & 3 deletions tests/modules/services/emacs-darwin/basic.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{ lib, pkgs, ... }:

{
{ lib, pkgs, ... }: {
nixpkgs.overlays = [
(self: super: rec {
emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // {
Expand Down
6 changes: 5 additions & 1 deletion tests/modules/services/emacs-darwin/expected-agent.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<dict>
<key>PATH</key>
<string>/home/hm-user/.nix-profile/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
<dict>
<key>Crashed</key>
<true/>
Expand All @@ -19,4 +23,4 @@
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
</plist>

0 comments on commit e87a088

Please sign in to comment.