home-manager/tests/modules/programs/emacs/extra-config.nix
Robert Helgesson 5f00024e75
tests: make enableBig an option
This makes it possible to identify the test as big in the test file
itself. It also seems like a more natural way to control the test
running.
2022-01-02 10:36:52 +01:00

27 lines
633 B
Nix

{ config, lib, pkgs, ... }:
let
testScript = pkgs.writeText "test.el" ''
;; Emacs won't automatically load default.el when --script is specified
(load "default")
(kill-emacs (if (eq hm 'home-manager) 0 1))
'';
emacsBin = "${config.programs.emacs.finalPackage}/bin/emacs";
in lib.mkIf config.test.enableBig {
programs.emacs = {
enable = true;
package = pkgs.emacs-nox;
extraConfig = "(setq hm 'home-manager)";
};
# running emacs with --script would enable headless mode
nmt.script = ''
if ! ${emacsBin} --script ${testScript}; then
fail "Failed to load default.el."
fi
'';
}