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:
parent
d5151186ac
commit
0f3dfc94ef
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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 = ''
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue