1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/modules/services/emacs.nix

56 lines
1.4 KiB
Nix
Raw Normal View History

2017-02-19 10:20:26 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.emacs;
2020-11-27 02:43:13 +00:00
in {
2017-02-19 10:20:26 +00:00
options = {
services.emacs = {
enable = mkOption {
type = types.bool;
default = false;
2024-04-14 21:02:32 +00:00
description = "Whether to enable the Emacs Daemon.";
2017-02-19 10:20:26 +00:00
};
package = mkOption {
type = types.path;
default = pkgs.emacs;
2024-04-14 21:02:32 +00:00
description = "This option specifies the emacs package to use.";
2017-02-19 10:20:26 +00:00
};
2020-11-27 02:43:13 +00:00
additionalPath = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "/Users/my_user_name" ];
2024-04-14 21:02:32 +00:00
description = ''
2020-11-27 02:43:13 +00:00
This option specifies additional PATH that the emacs daemon would have.
Typically if you have binaries in your home directory that is what you would add your home path here.
One caveat is that there won't be shell variable expansion, so you can't use $HOME for example
'';
};
exec = mkOption {
type = types.str;
default = "emacs";
2024-04-14 21:02:32 +00:00
description = "Emacs command/binary to execute.";
};
2017-02-19 10:20:26 +00:00
};
};
config = mkIf cfg.enable {
launchd.user.agents.emacs = {
2020-11-27 02:43:13 +00:00
path = cfg.additionalPath ++ [ config.environment.systemPath ];
2024-10-26 16:08:45 +00:00
serviceConfig = {
ProgramArguments = [ "${cfg.package}/bin/${cfg.exec}" "--fg-daemon" ];
RunAtLoad = true;
KeepAlive = true;
};
2017-02-19 10:20:26 +00:00
};
};
}