Can't use xmonad on NixOS

Hi,

I’m playing with the NixOS virtualbox image and trying to setup xmonad.

This is my configuration:

{ lib, config, pkgs, ... }:

{
  imports = [ <nixpkgs/nixos/modules/installer/virtualbox-demo.nix> ];

  services.xserver = {

    displayManager = {
      lightdm.enable = true;
      defaultSession = "none+xmonad";
    };

    enable = true;

    windowManager.xmonad = {
      enable = true;
      enableContribAndExtras = true;
      extraPackages = hp: [ hp.xmonad hp.xmonad-contrib hp.xmonad-extras ];
    };
  };

 services.xserver.displayManager.sddm.enable = lib.mkForce false;
 services.xserver.desktopManager.plasma5.enable = lib.mkForce false;
}

And this is the logs I got with journalctl -t xmonad:

-- Reboot --
Mar 02 13:05:05 nixos xmonad[803]: XMonad is recompiling and replacing itself another XMonad process because the current process is called "xmonad" but the compiled configuration should be called "xmonad-x86_64-linux"
Mar 02 13:05:05 nixos xmonad[803]: XMonad will use ghc to recompile, because "/home/demo/.xmonad/build" does not exist.
Mar 02 13:05:05 nixos xmonad[803]: XMonad skipping recompile because it is not forced (e.g. via --recompile), and neither xmonad.hs nor any *.hs / *.lhs / *.hsc files in lib/ have been changed.
Mar 02 13:05:05 nixos xmonad[803]: /home/demo/.xmonad/xmonad-x86_64-linux: executeFile: does not exist (No such file or directory)

I’ve never used xmonad before so I’m not too sure what I’m missing :-S

1 Like

If I remeber correctly, that is not really an error and xmonad should start anyway. What is happening on your screen?

Nothing, just a black screen. I don’t see the mouse pointer either.

Have you tried opening a terminal? The default keybinging should be Mod+Shift+Return.

I don’t use a display manager myself, but apart from that your configuration seems equivalent to mine, though

seems a bit redundant. I have only the former.

I thought I did… You’re right, it’s working fine :sweat_smile:

welcome to xmonad :smiley:

1 Like

In general you probably want a ~/.xmonad/xmonad.hs file to configure XMonad.

I believe that’s what this “error” is saying:

Mar 02 13:05:05 nixos xmonad[803]: XMonad skipping recompile because it is not forced (e.g. via --recompile), and neither xmonad.hs nor any *.hs / *.lhs / *.hsc files in lib/ have been changed.

I wanted to give you a link to help you get started with creating a xmonad.hs, and I found this: xmonad - ArchWiki. This also has links to other pages that might be helpful.

Although keep in mind that if you’re not a Haskeller, configuring XMonad is definitely not trivial.

1 Like