commit 718f9cf5355752f0643332b1746fda062fa0b931 parent c18a72a7434b8320b0440e05772a55ad98e8c178 Author: Vincent Demeester <vincent@sbr.pm> Date: Mon, 26 Nov 2018 10:45:22 +0100 emacs: make daemon service customizable… … to fix OSX setup. Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | modules/profiles/emacs.nix | | | 41 | ++++++++++++++++++++++++----------------- |
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/modules/profiles/emacs.nix b/modules/profiles/emacs.nix @@ -12,28 +12,16 @@ in description = "Enable emacs profile"; type = types.bool; }; + daemonService = mkOption { + default = true; + description = "Enable emacs daemon service"; + type = types.bool; + }; }; }; config = mkIf cfg.enable (mkMerge [ { home.file.".local/share/applications/org-protocol.desktop".source = ./assets/xorg/org-protocol.desktop; - systemd.user.services.emacs = { - Unit = { - Description = "Emacs: the extensible, self-documenting text editor"; - }; - Service = { - Environment = '' - PATH=/home/vincent/bin:/home/vincent/.local/npm/bin:/run/wrappers/bin:/etc/profiles/per-user/vincent/bin:${config.home.profileDirectory}/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin GOPATH=/home/vincent ASPELL_CONF=dict-dir=/home/vincent/.nix-profile/lib/aspell - ''; - Type = "forking"; - ExecStart = "${pkgs.bash}/bin/bash -c 'source /etc/profile; exec /home/vincent/.nix-profile/bin/emacs --daemon'"; - ExecStop = "/home/vincent/.nix-profile/bin/emacsclient --eval (kill-emacs)"; - Restart = "always"; - }; - Install = { - WantedBy = [ "default.target" ]; - }; - }; programs.emacs = { enable = true; # package = pkgs.myEmacs; @@ -228,5 +216,24 @@ in allow-emacs-pinentry ''; }) + (mkIf cfg.daemonService { + systemd.user.services.emacs = { + Unit = { + Description = "Emacs: the extensible, self-documenting text editor"; + }; + Service = { + Environment = '' + PATH=/home/vincent/bin:/home/vincent/.local/npm/bin:/run/wrappers/bin:/etc/profiles/per-user/vincent/bin:${config.home.profileDirectory}/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin GOPATH=/home/vincent ASPELL_CONF=dict-dir=/home/vincent/.nix-profile/lib/aspell + ''; + Type = "forking"; + ExecStart = "${pkgs.bash}/bin/bash -c 'source /etc/profile; exec /home/vincent/.nix-profile/bin/emacs --daemon'"; + ExecStop = "/home/vincent/.nix-profile/bin/emacsclient --eval (kill-emacs)"; + Restart = "always"; + }; + Install = { + WantedBy = [ "default.target" ]; + }; + }; + }) ]); }