mirror of
https://github.com/nix-community/home-manager
synced 2024-11-09 12:49:44 +01:00
931653b99f
Add services.emacs.startWithUserSession boolean to indicate that Emacs must be started with the systemd user session. This is true by default unless socket activation is also true. In the past, the user had to choose between socket activation (to get the Emacs service started when the user uses emacsclient) and immediate start with the user session. When choosing immediate start over socket activation and if the Emacs service is stopped at some point, using emacsclient would start a new Emacs daemon but the service would still be turned off. This situation would prevent `home-manager switch` from completing successfully because it wouldn't be able to start the Emacs service as Emacs is already running. This new setting makes it possible to have both socket activation and immediate start at the same time. In this scenario, Emacs is started with the user session and, after the Emacs service is stopped, using emacsclient starts the service again. This new settings also makes it possible to have neither socket activation nor immediate start.
27 lines
553 B
Nix
27 lines
553 B
Nix
{ lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
{
|
|
services.emacs = {
|
|
enable = true;
|
|
socketActivation.enable = true;
|
|
startWithUserSession = true;
|
|
};
|
|
|
|
nixpkgs.overlays = [
|
|
(self: super: rec {
|
|
emacs = pkgs.writeShellScriptBin "dummy-emacs-28.0.5" "" // {
|
|
outPath = "@emacs@";
|
|
};
|
|
emacsPackagesFor = _:
|
|
makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
|
|
})
|
|
];
|
|
|
|
nmt.script = ''
|
|
assertFileContains \
|
|
home-files/.config/systemd/user/emacs.service \
|
|
"WantedBy=default.target"
|
|
'';
|
|
}
|