home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 658d249b8ec2c480dcc3edb6de2680b05194c051
parent acb20deccbcf1d309846a95ecb447b605161be2a
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri, 13 Nov 2020 17:10:11 +0100

users/vincent: clean emacs services.

Use h-m emacs service and remove my own implementation. It is simpler
and works better (socketActivation 🙃)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Musers/modules/services/default.nix | 1-
Dusers/modules/services/emacs-server.nix | 56--------------------------------------------------------
Musers/vincent/dev/emacs.nix | 12+++---------
Musers/vincent/dev/emacs/org-protocol.desktop | 2+-
4 files changed, 4 insertions(+), 67 deletions(-)

diff --git a/users/modules/services/default.nix b/users/modules/services/default.nix @@ -1,5 +1,4 @@ { imports = [ - ./emacs-server.nix ]; } diff --git a/users/modules/services/emacs-server.nix b/users/modules/services/emacs-server.nix @@ -1,56 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.services.emacs-server; -in -{ - options.services.emacs-server = { - enable = mkEnableOption "the Emacs daemon"; - name = mkOption { - type = types.str; - description = "Name of the emacs server"; - default = "default"; - }; - package = mkOption { - type = types.package; - description = "The Emacs package to use for running the daemon."; - }; - shell = mkOption { - type = types.str; - description = "The shell used for starting Emacs."; - }; - extraOptions = mkOption { - type = types.separatedString " "; - default = ""; - description = - '' - The extra command-line options to pass to - <command>emacs</command> daemon. - ''; - }; - }; - - config = mkIf cfg.enable { - systemd.user.services.emacs-server = { - Unit = { - Description = "Emacs: the extensible, self-documenting text editor"; - Documentation = - "info:emacs man:emacs(1) https://gnu.org/software/emacs/"; - - # Avoid killing the Emacs session, which may be full of - # unsaved buffers. - X-RestartIfChanged = false; - }; - - Service = { - ExecStart = - "${cfg.shell} 'exec emacs --fg-daemon=${cfg.name} ${cfg.extraOptions}'"; - ExecStop = "${cfg.shell} 'emacsclient --eval '(kill-emacs)''"; - Restart = "on-failure"; - Environment = "DISPLAY=:0"; - }; - - Install = { WantedBy = [ "default.target" ]; }; - }; - }; -} diff --git a/users/vincent/dev/emacs.nix b/users/vincent/dev/emacs.nix @@ -5,7 +5,7 @@ with lib; let capture = pkgs.writeScriptBin "capture" '' #!${pkgs.stdenv.shell} - emacsclient -s /run/user/1000/emacs/org -n -F '((name . "capture") (width . 150) (height . 90))' -e '(org-capture)' + emacsclient -n -F '((name . "capture") (width . 150) (height . 90))' -e '(org-capture)' ''; e = pkgs.writeScriptBin "e" '' #!${pkgs.stdenv.shell} @@ -13,11 +13,11 @@ let ''; et = pkgs.writeScriptBin "et" '' #!${pkgs.stdenv.shell} - emacsclient -s /run/user/1000/emacs/org --tty $@ + emacsclient --tty $@ ''; ec = pkgs.writeScriptBin "ec" '' #!${pkgs.stdenv.shell} - emacsclient -s /run/user/1000/emacs/org --create-frame $@ + emacsclient --create-frame $@ ''; myExtraPackages = epkgs: with epkgs; [ ace-window @@ -149,12 +149,6 @@ in client.enable = true; socketActivation.enable = true; }; - services.emacs-server = { - enable = true; - package = pkgs.my.emacs; - name = "org"; - shell = pkgs.zsh + "/bin/zsh -i -c"; - }; home.sessionVariables = { EDITOR = "emacs"; ALTERNATE_EDITOR = "emacs -nw"; diff --git a/users/vincent/dev/emacs/org-protocol.desktop b/users/vincent/dev/emacs/org-protocol.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Name=org-protocol -Exec=emacsclient -s /run/user/1000/emacs/org -n %u +Exec=emacsclient -n %u Type=Application Terminal=false Categories=System;