I’m unable to successfully install a default, minimal xmonad system using nixos 24.11.
Expected behavior: xmonad works out of the box as per XMonad - NixOS Wiki
Actual behavior: system boots to xmonad, but configuration file fails to compile
My system definition is a flake.nix
:
{
description = "A simple NixOS flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
kmonad = {
url = "git+https://github.com/kmonad/kmonad?submodules=1&dir=nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, kmonad, ... }@inputs: {
nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
kmonad.nixosModules.default
];
};
};
}
that invokes a configuration.nix
(whose xmonad definition is taken from the wiki) (I commented out everything irrelevant):
{ config, lib, pkgs, ... }:
{
#enable flakes
#hardware config import
#boot loader/lvm stuff
services.xserver = {
enable = true;
windowManager.xmonad = {
enable = true;
enableConfiguredRecompile = true;
config = builtins.readFile ./xmonad.hs;
enableContribAndExtras = true;
};
};
#libinput stuff
#network/timezone/locale stuff
#kmonad service
#syncthing stuff
#sound stuff
#emacs stuff
#user definition
#system packages (no ghc, xmonad, or haskell-related packages)
programs.direnv.enable = true;
#system state version suff
}
with an xmonad.hs
:
import XMonad
import XMonad.Config.Desktop
main = xmonad desktopConfig
{ terminal = "ghostty"
}
The system boots to a display manager and then xmonad, but journalctl -t xmonad
shows errors:
Mar 03 17:34:18 myhost xmonad[1390]: XMonad is recompiling and replacing itself with another XMonad process because the current process is called "xmonad" but the compiled configuration should be called "xmonad-x86_64-linux"
Mar 03 17:34:18 myhost xmonad[1390]: XMonad will use ghc to recompile, because neither "/home/myuser/.config/xmonad/build" nor "/home/myuser/.config/xmonad/stack.yaml" exists.
Mar 03 17:34:18 myhost xmonad[1390]: 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 03 17:34:19 myhost xmonad[1390]: xmonad: X11 error: BadAtom (invalid Atom parameter), request code=18, error code=5
Mar 03 17:34:26 myhost xmonad[1539]: xmonad is /run/current-system/sw/bin/xmonad
Mar 03 17:34:26 myhost xmonad[1541]: XMonad will use ghc to recompile, because neither "/home/myuser/.config/xmonad/build" nor "/home/myuser/.config/xmonad/stack.yaml" exists.
Mar 03 17:34:26 myhost xmonad[1541]: XMonad recompiling (forced).
Mar 03 17:34:27 myhost xmonad[1541]: Errors detected while compiling xmonad config: /home/myuser/.config/xmonad/xmonad.hs
Mar 03 17:34:27 myhost xmonad[1541]: $ /nix/store/09lshns3b6wlmz6wzpkik8rp9w16fd5b-ghc-9.6.6-with-packages/bin/ghc --make xmonad.hs -i -ilib -fforce-recomp -main-is main -v0 -outputdir /home/myuser/.cache/xmonad/build-x86_64-linux -o /home/myuser/.cache/xmonad/xmonad-x86_64-linux
Mar 03 17:34:27 myhost xmonad[1541]: xmonad.hs:1:1: error:
Mar 03 17:34:27 myhost xmonad[1541]: Could not load module ‘XMonad’
Mar 03 17:34:27 myhost xmonad[1541]: It is a member of the hidden package ‘xmonad-0.17.2’.
Mar 03 17:34:27 myhost xmonad[1541]: You can run ‘:set -package xmonad’ to expose it.
Mar 03 17:34:27 myhost xmonad[1541]: (Note: this unloads all the modules in the current scope.)
Mar 03 17:34:27 myhost xmonad[1541]: Use -v (or `:set -v` in ghci) to see a list of the files searched for.
Mar 03 17:34:27 myhost xmonad[1541]: |
Mar 03 17:34:27 myhost xmonad[1541]: 1 | import XMonad
Mar 03 17:34:27 myhost xmonad[1541]: | ^^^^^^^^^^^^^
Mar 03 17:34:27 myhost xmonad[1541]: xmonad.hs:2:1: error:
Mar 03 17:34:27 myhost xmonad[1541]: Could not load module ‘XMonad.Config.Kde’
Mar 03 17:34:27 myhost xmonad[1541]: It is a member of the hidden package ‘xmonad-contrib-0.18.0’.
Mar 03 17:34:27 myhost xmonad[1541]: You can run ‘:set -package xmonad-contrib’ to expose it.
Mar 03 17:34:27 myhost xmonad[1541]: (Note: this unloads all the modules in the current scope.)
Mar 03 17:34:27 myhost xmonad[1541]: Use -v (or `:set -v` in ghci) to see a list of the files searched for.
Mar 03 17:34:27 myhost xmonad[1541]: |
Mar 03 17:34:27 myhost xmonad[1541]: 2 | import XMonad.Config.Kde
Mar 03 17:34:27 myhost xmonad[1541]: | ^^^^^^^^^^^^^^^^^^^^^^^^
Mar 03 17:34:27 myhost xmonad[1541]: xmonad.hs:3:1: error:
Mar 03 17:34:27 myhost xmonad[1541]: Could not load module ‘XMonad.StackSet’
Mar 03 17:34:27 myhost xmonad[1541]: It is a member of the hidden package ‘xmonad-0.17.2’.
Mar 03 17:34:27 myhost xmonad[1541]: You can run ‘:set -package xmonad’ to expose it.
Mar 03 17:34:27 myhost xmonad[1541]: (Note: this unloads all the modules in the current scope.)
Mar 03 17:34:27 myhost xmonad[1541]: Use -v (or `:set -v` in ghci) to see a list of the files searched for.
Mar 03 17:34:27 myhost xmonad[1541]: |
Mar 03 17:34:27 myhost xmonad[1541]: 3 | import qualified XMonad.StackSet as W -- to shift and float windows
Mar 03 17:34:27 myhost xmonad[1541]: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 03 17:34:27 myhost xmonad[1541]: Please check the file for errors.
Mar 03 17:34:27 myhost xmonad[1552]: Warning: Missing charsets in String to FontSet conversion
The default xmonad terminal is unchanged, and M-q
(xmonad --recompile
) breaks with the same compiler errors from the above log. Thanks for reading