NixOS, tuigreet, EXWM, and alpha-background
===========================================
When I was transitioning to NixOS, I had some trouble with my EXWM config. I figured I would put my solutions here in case they can help anyone else.
With tuigreet, I found that no X server was starting. tuigreet uses xstart, which isn't exposed by default on Nix. To use xstart, you need to set services.xserver.displayManager.startx.enable to true.
As for EXWM, I couldn't get the alpha-background frame parameter to work. I thought it might be a compositor issue, but the alpha frame parameter was working fine. It turns out that the default Nix Emacs doesn't use GTK, and alpha-background needs GTK to work. To fix this, we can tell EXWM to use emacs-gtk.
Here is my working configuration:
# set up exwm
services.xserver = {
enable = true;
displayManager.startx.enable = true;
windowManager.exwm = {
enable = true;
package = pkgs.emacs-gtk;
};
};
# make greetd load up exwm
services.greetd = let
tuigreet = "${pkgs.greetd.tuigreet}/bin/tuigreet";
xsessions = "${config.services.displayManager.sessionData.desktops}/share/xsessions";
in {
enable = true;
settings = {
default_session = {
command = "${tuigreet} -x ${xsessions}";
user = "greeter";
};
};
};
Before the exwm.package option existed, I started Emacs manually like this:
services.xserver.windowManager.session = lib.singleton {
name = "exwm";
start = "${pkgs.emacs-gtk}/bin/emacs";
};
Alternatively, you could override EXWM's Emacs package like this:
nixpkgs.overlays = [ (final: prev: { emacs = prev.emacs-gtk; }) ];
~/nix.html