[Nix-dev] Emacs daemon as a user systemd service in NixOS

Damien Cassou damien.cassou at gmail.com
Sun Oct 12 15:33:21 CEST 2014


Hi,

On NixOS, I would like systemd to start emacs (daemon) once and for all so
that I can just use emacs-client all the times. I put this content in
~/.config/systemd/user/emacs.service:

------------------------------------------------------------------
[Unit]
Description=Emacs: the extensible, self-documenting text editor

[Service]
Type=forking
ExecStart=/run/current-system/sw/bin/emacs --daemon
ExecStop=/run/current-system/sw/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=always

[Install]
WantedBy=default.target
------------------------------------------------------------------

The problem is that many environment variables are missing. For exemple,
opening any gnome application (e.g., evince) from emacs will result in an
un-themed window. To fix that I can add the following to the Environment
property in the service file:

    GTK_DATA_PREFIX=/nix/store/pd7189r7nwwpbsr74fsil5bzjwnm90j9-system-path


But this path will change in the future, the GTK_DATA_PREFIX variable being
defined as

    GTK_DATA_PREFIX=${config.system.path}


How can I define an Emacs daemon user-based systemd service in NixOS?

Thank you very much


-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without losing
enthusiasm."
Winston Churchill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20141012/b1301bf6/attachment.html 


More information about the nix-dev mailing list