tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
Add a module for Emacs daemon
Damien Cassou
9 years ago
958ae22c
125ffff0
+66
2 changed files
expand all
collapse all
unified
split
nixos
modules
module-list.nix
services
editors
emacs.nix
+1
nixos/modules/module-list.nix
···
164
./services/desktops/profile-sync-daemon.nix
165
./services/desktops/telepathy.nix
166
./services/development/hoogle.nix
0
167
./services/games/factorio.nix
168
./services/games/ghost-one.nix
169
./services/games/minecraft-server.nix
···
164
./services/desktops/profile-sync-daemon.nix
165
./services/desktops/telepathy.nix
166
./services/development/hoogle.nix
167
+
./services/editors/emacs.nix
168
./services/games/factorio.nix
169
./services/games/ghost-one.nix
170
./services/games/minecraft-server.nix
+65
nixos/modules/services/editors/emacs.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
1
+
{ config, lib, pkgs, ... }:
2
+
3
+
with lib;
4
+
5
+
let
6
+
7
+
cfg = config.services.emacs;
8
+
9
+
in {
10
+
11
+
options.services.emacs = {
12
+
enable = mkOption {
13
+
type = types.bool;
14
+
default = false;
15
+
example = true;
16
+
description = ''
17
+
Whether to enable a user service for the Emacs daemon. Use <literal>emacsclient</literal> to connect to the
18
+
daemon. If <literal>true</literal>, <varname>services.emacs.install</varname> is
19
+
considered <literal>true</literal>, whatever its value.
20
+
'';
21
+
};
22
+
23
+
install = mkOption {
24
+
type = types.bool;
25
+
default = false;
26
+
example = true;
27
+
description = ''
28
+
Whether to install a user service for the Emacs daemon. Once
29
+
the service is started, use emacsclient to connect to the
30
+
daemon.
31
+
32
+
The service must be manually started for each user with
33
+
"systemctl --user start emacs" or globally through
34
+
<varname>services.emacs.enable</varname>.
35
+
'';
36
+
};
37
+
38
+
39
+
package = mkOption {
40
+
type = types.package;
41
+
default = pkgs.emacs;
42
+
defaultText = "pkgs.emacs";
43
+
description = ''
44
+
emacs derivation to use.
45
+
'';
46
+
};
47
+
48
+
};
49
+
50
+
config = mkIf (cfg.enable || cfg.install) {
51
+
systemd.user.services.emacs = {
52
+
description = "Emacs: the extensible, self-documenting text editor";
53
+
54
+
serviceConfig = {
55
+
Type = "forking";
56
+
ExecStart = "${pkgs.bash}/bin/bash -c 'source ${config.system.build.setEnvironment}; exec ${cfg.package}/bin/emacs --daemon'";
57
+
ExecStop = "${cfg.package}/bin/emacsclient --eval (kill-emacs)";
58
+
Restart = "always";
59
+
};
60
+
} // optionalAttrs cfg.enable { wantedBy = [ "default.target" ]; };
61
+
62
+
environment.systemPackages = [ cfg.package ];
63
+
};
64
+
65
+
}