aboutsummaryrefslogtreecommitdiff
path: root/home-manager/tests/modules/services/emacs/emacs-service.nix
blob: be27e9ab33d202818f94885fa4cbd32156b89b29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ config, lib, pkgs, ... }:

with lib;

{
  config = {
    nixpkgs.overlays = [
      (self: super: rec {
        emacs = pkgs.writeShellScriptBin "dummy-emacs" "" // {
          outPath = "@emacs@";
        };
        emacsPackagesFor = _:
          makeScope super.newScope (_: { emacsWithPackages = _: emacs; });
      })
    ];

    programs.emacs.enable = true;
    services.emacs.enable = true;
    services.emacs.client.enable = true;

    nmt.script = ''
      assertPathNotExists home-files/.config/systemd/user/emacs.socket
      assertFileExists home-files/.config/systemd/user/emacs.service
      assertFileExists home-path/share/applications/emacsclient.desktop

      assertFileContent home-files/.config/systemd/user/emacs.service \
                        ${
                          pkgs.substituteAll {
                            inherit (pkgs) runtimeShell;
                            src = ./emacs-service-emacs.service;
                          }
                        }
      assertFileContent home-path/share/applications/emacsclient.desktop \
                        ${./emacs-emacsclient.desktop}
    '';
  };
}