-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemacs-setup.nix
44 lines (40 loc) · 1.51 KB
/
emacs-setup.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{config, pkgs, ...}:
let emacs = import ./emacs.nix { inherit pkgs; };
startEmacsServer = pkgs.writeScript "start-emacs-server" ''
#!/bin/sh
. ${config.system.build.setEnvironment}
${emacs}/bin/emacs --daemon
'';
in {
# Create a systemd user service for emacs daemon. This is useful because
# systemd will take care of launching emacs in the background and I
# will just have to connect to it through emacs-client. This is a
# user service. This means I have to pass the "--user" option to
# systemd when I want to control the service.
environment.systemPackages = with pkgs; [
emacs texinfo w3m
# emacs dependencies
notmuch # From main packages set
offlineimap
haskellPackages.structured-haskell-mode # From haskell set
haskellPackages.hlint
haskellPackages.hasktags
haskellPackages.stylish-haskell
ocaml opam gnum4 # aspcud (not yet present in nixos)
ocamlPackages.merlin # From ocaml set
ocamlPackages.ocpIndent
dejavu_fonts
];
systemd.user.services.emacs = {
description = "Emacs: the extensible, self-documenting text editor";
enable = true;
environment.SSH_AUTH_SOCK = "%h/.gnupg/S.gpg-agent.ssh";
serviceConfig = {
Type = "forking";
ExecStart = "${startEmacsServer}";
ExecStop = "${emacs}/bin/emacsclient --eval (kill-emacs)";
Restart = "always";
};
wantedBy = [ "default.target" ];
};
}