NixOS for the confused – Part III

Previously... We pretty much got a very barebones Hyprland install going, and we did it by using a flake within a flake. Pretty cool. You can run with that if you want, but that's no fun. Really, you can find a bunch of Hyprland config examples across the internet. What we are going to do, however, is get rid of it because fuck that project.

Okay! What do we do, then? Let's go with the Awesome WM, shall we? “But I wanted Hyprland... whyyy?” Because, dear reader, Hyprland doesn't play well with some monitors over HDMI. Specifically, my monitor. Long story short, after a set time, the screen should lock and the monitor should turn off. It doesn't, the screen lock is bypassed, and a new workspace is created out of nowhere. I did open an issue on the project's GitHub, and other folks seem to have the same problem. It won't get fixed, I don't give a shit, and there are alternatives. So, AwesomeWM.

But, hey... here's the beauty of this thing: you can absolutely leave the Hyprland flake alone, create another one for Awesome, and switch back and forth. You can also have one big flake and do something like:

 nixosConfigurations = {
      hyprLuffy = nixpkgs.lib.nixosSystem {
        specialArgs = { inherit inputs; }; 
        modules = [ 
          ./nixos/configuration.nix
          hyprland.nixosModules.default
	  {programs.hyprland.enable = true;}
        ];
      };

      awesomeLuffy = nixpkgs.lib.nixosSystem {
        specialArgs = { inherit inputs; }; 
        modules = [ 
          ./nixos/configuration.nix
        ];
      };
    };

And use .#hyprLuffy or .#awesomeLuffy as the targets for sudo nixos-rebuild switch.

Anyhoo. Enough of that Hyprland nonsense. Let's get AwesomeWM going. Unlike Hyprland, installing AwesomeWM is pretty straightforward. Just add some stuff to your configuration.nix for a system-wide install, or use Home Manager to install it only for your user. I'm going with configuration.nix, but you can read the Home Manager instructions here.

The wiki says it's only a matter of setting services.xserver.windowManager.awesome.enable to true. Okay, then! To keep things simple, we need to get rid of the Hypeland shit, and add our AwesomeWM stuff. Our configuration.nix could have something like this added to it:

services.xserver = {
    enable = true;
    layout = "us";
    xkbVariant = "";
    desktopManager = {
        xfce = {
          enable = true;
          noDesktop = true;
          enableXfwm = false;
        };
    };
    windowManager.awesome.enable = true;
    libinput.enable = true;
    libinput.mouse.naturalScrolling = true;
    libinput.touchpad.naturalScrolling = true;
  };

Here I am doing a few things: enabling Awesome, doing some mouse/touchpad tweaks, and getting XFCE installed to manager our login screen, locking the session, that kind of jazz. The whole desktopManager section is kinda optional, but I do want to boot into the graphical environment, and login there. You can probably get away with just adding windowManager.awesome.enable = true; to the services.xserver section. Save your configuration.nix, and run the now classic sudo nixos-rebuild switch .#luffy. Boom. The stock AwesomeWM that looks definitely not awesome should be right there after you reboot! As always, the files are available on Codeberg for your copying and pasting pleasure. We'll prettify this thing next time.

Discuss...