From 79c902422a1b389fa8252d111efd296827d76afd Mon Sep 17 00:00:00 2001 From: Piotr Limanowski Date: Sun, 19 Feb 2017 11:20:26 +0100 Subject: [PATCH] adds emacs launchd service --- default.nix | 1 + modules/services/emacs.nix | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 modules/services/emacs.nix diff --git a/default.nix b/default.nix index 9974314a..28316f7e 100644 --- a/default.nix +++ b/default.nix @@ -38,6 +38,7 @@ let ./modules/services/activate-system.nix ./modules/services/khd.nix ./modules/services/kwm.nix + ./modules/services/emacs.nix ./modules/services/nix-daemon.nix ./modules/programs/bash.nix ./modules/programs/fish.nix diff --git a/modules/services/emacs.nix b/modules/services/emacs.nix new file mode 100644 index 00000000..21f4f8c5 --- /dev/null +++ b/modules/services/emacs.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.emacs; + +in + +{ + options = { + services.emacs = { + + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable the Emacs Daemon."; + }; + + package = mkOption { + type = types.path; + default = pkgs.emacs; + description = "This option specifies the emacs package to use."; + }; + + }; + }; + + config = mkIf cfg.enable { + + launchd.user.agents.emacs = { + serviceConfig.ProgramArguments = [ + "${cfg.package}/bin/emacs" + "--daemon" + ]; + serviceConfig.RunAtLoad = true; + }; + + }; +} \ No newline at end of file