1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

services.emacs: add option extraOptions

This is to allow adding command-line arguments to the Emacs daemon.
Previously only the Emacs client could be started with custom
arguments.
This commit is contained in:
schotts-fired 2021-09-29 15:07:38 +02:00 committed by Robert Helgesson
parent d5151186ac
commit 0f3dfc94ef
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
7 changed files with 16 additions and 3 deletions

View file

@ -54,6 +54,15 @@ in {
description = "The Emacs package to use.";
};
extraOptions = mkOption {
type = with types; listOf str;
default = [ ];
example = [ "-f" "exwm-enable" ];
description = ''
Extra command-line arguments to pass to <command>emacs</command>.
'';
};
client = {
enable = mkEnableOption "generation of Emacs client desktop file";
arguments = mkOption {
@ -111,7 +120,7 @@ in {
# when using socket activation.
optionalString cfg.socketActivation.enable
"=${escapeShellArg socketPath}"
}"'';
} ${escapeShellArgs cfg.extraOptions}"'';
# Emacs will exit with status 15 after having received SIGTERM, which
# is the default "KillSignal" value systemd uses to stop services.

View file

@ -17,6 +17,7 @@ with lib;
programs.emacs.enable = true;
services.emacs.enable = true;
services.emacs.client.enable = true;
services.emacs.extraOptions = [ "-f" "exwm-enable" ];
nmt.script = ''
assertPathNotExists home-files/.config/systemd/user/emacs.socket

View file

@ -17,6 +17,7 @@ with lib;
programs.emacs.enable = true;
services.emacs.enable = true;
services.emacs.client.enable = true;
services.emacs.extraOptions = [ "-f" "exwm-enable" ];
nmt.script = ''
assertPathNotExists home-files/.config/systemd/user/emacs.socket

View file

@ -2,7 +2,7 @@
WantedBy=default.target
[Service]
ExecStart=@runtimeShell@ -l -c "@emacs@/bin/emacs --fg-daemon"
ExecStart=@runtimeShell@ -l -c "@emacs@/bin/emacs --fg-daemon '-f' 'exwm-enable'"
Restart=on-failure
SuccessExitStatus=15
Type=notify

View file

@ -19,6 +19,7 @@ in {
programs.emacs.enable = true;
services.emacs.enable = true;
services.emacs.client.enable = true;
services.emacs.extraOptions = [ "-f" "exwm-enable" ];
services.emacs.socketActivation.enable = true;
nmt.script = ''

View file

@ -19,6 +19,7 @@ in {
programs.emacs.enable = true;
services.emacs.enable = true;
services.emacs.client.enable = true;
services.emacs.extraOptions = [ "-f" "exwm-enable" ];
services.emacs.socketActivation.enable = true;
nmt.script = ''

View file

@ -1,5 +1,5 @@
[Service]
ExecStart=@runtimeShell@ -l -c "@emacs@/bin/emacs --fg-daemon='%t/emacs/server'"
ExecStart=@runtimeShell@ -l -c "@emacs@/bin/emacs --fg-daemon='%t/emacs/server' '-f' 'exwm-enable'"
ExecStartPost=@coreutils@/bin/chmod --changes -w %t/emacs
ExecStopPost=@coreutils@/bin/chmod --changes +w %t/emacs
Restart=on-failure