mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
nixos/emacs: start emacs service with the graphical-session
If emacs starts before the graphical session is initialised, clients won't be able to open new frames in the session. Start emacs with the graphical session to avoid this issue. Fixes https://github.com/NixOS/nixpkgs/issues/224512
This commit is contained in:
parent
c9cf0708f0
commit
d391373c40
1 changed files with 16 additions and 1 deletions
|
@ -80,6 +80,15 @@ in
|
|||
using the EDITOR environment variable.
|
||||
'';
|
||||
};
|
||||
|
||||
startWithGraphical = mkOption {
|
||||
type = types.bool;
|
||||
default = config.services.xserver.enable;
|
||||
defaultText = literalExpression "config.services.xserver.enable";
|
||||
description = lib.mdDoc ''
|
||||
Start emacs with the graphical session instead of any session. Without this, emacs clients will not be able to create frames in the graphical session.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable || cfg.install) {
|
||||
|
@ -92,7 +101,13 @@ in
|
|||
ExecStop = "${cfg.package}/bin/emacsclient --eval (kill-emacs)";
|
||||
Restart = "always";
|
||||
};
|
||||
} // optionalAttrs cfg.enable { wantedBy = [ "default.target" ]; };
|
||||
|
||||
unitConfig = optionalAttrs cfg.startWithGraphical {
|
||||
After = "graphical-session.target";
|
||||
};
|
||||
} // optionalAttrs cfg.enable {
|
||||
wantedBy = if cfg.startWithGraphical then [ "graphical-session.target" ] else [ "default.target" ];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.package editorScript desktopApplicationFile ];
|
||||
|
||||
|
|
Loading…
Reference in a new issue