From fab273bf4e4b9a93af712a5306e57d663dd0e8fe Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sat, 15 Oct 2022 05:20:05 -0400 Subject: [PATCH] Emacs launchd agent --- home-manager/darwin/default.nix | 4 +++- home-manager/darwin/programs/emacs.nix | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 home-manager/darwin/programs/emacs.nix diff --git a/home-manager/darwin/default.nix b/home-manager/darwin/default.nix index b6bd37b..49904ca 100644 --- a/home-manager/darwin/default.nix +++ b/home-manager/darwin/default.nix @@ -11,9 +11,9 @@ with nLib; { ../options.nix ../common/programs/core.nix ../common/programs/devel.nix - ../common/programs/emacs.nix ../common/programs/terminal.nix ./programs/core.nix + ./programs/emacs.nix ]; options = { @@ -50,5 +50,7 @@ with nLib; { home.stateVersion = "22.05"; programs.home-manager.enable = true; nathan.programs.emacs.package = lib.mkDefault pkgs.emacs28NativeComp; + # Allow management of launchd agents + launchd.enable = true; }; } diff --git a/home-manager/darwin/programs/emacs.nix b/home-manager/darwin/programs/emacs.nix new file mode 100644 index 0000000..a6b7dbd --- /dev/null +++ b/home-manager/darwin/programs/emacs.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, inputs, ... }: + +{ + imports = [ ../../common/programs/emacs.nix ]; + + config = lib.mkIf config.nathan.programs.emacs.enable { + # Setup service + launchd.agents.emacs = { + enable = true; + config = { + ProgramArguments = + [ "/etc/profiles/per-user/nathan/bin/emacs" "--daemon" ]; + ProcessType = "Interactive"; + RunAtLoad = true; + }; + }; + }; +}