1 { config, lib, pkgs, ... }:
6 cfg = config.services.xserver.windowManager.exwm;
7 loadScript = pkgs.writeText "emacs-exwm-load" ''
9 ${optionalString cfg.enableDefaultConfig ''
10 (require 'exwm-config)
14 packages = epkgs: cfg.extraPackages epkgs ++ [ epkgs.exwm ];
15 exwm-emacs = pkgs.emacsWithPackages packages;
20 services.xserver.windowManager.exwm = {
21 enable = mkEnableOption (lib.mdDoc "exwm");
22 loadScript = mkOption {
23 default = "(require 'exwm)";
29 description = lib.mdDoc ''
30 Emacs lisp code to be run after loading the user's init
31 file. If enableDefaultConfig is true, this will be run
32 before loading the default config.
35 enableDefaultConfig = mkOption {
37 type = lib.types.bool;
38 description = lib.mdDoc "Enable an uncustomised exwm configuration.";
40 extraPackages = mkOption {
41 type = types.functionTo (types.listOf types.package);
43 defaultText = literalExpression "epkgs: []";
44 example = literalExpression ''
51 description = lib.mdDoc ''
52 Extra packages available to Emacs. The value must be a
53 function which receives the attrset defined in
54 {var}`emacs.pkgs` as the sole argument.
60 config = mkIf cfg.enable {
61 services.xserver.windowManager.session = singleton {
64 ${exwm-emacs}/bin/emacs -l ${loadScript}
67 environment.systemPackages = [ exwm-emacs ];