Xmonad not reading xmonad.hs

Good evening!

I just installed nixOS, using my old config, but something seems to have broken in the process. it seems most things are working besides my xmonad config.

I have it in ~/.config/xmonad but it just isn’t getting read. I’m posting this from a vanilla xmonad session. :frowning:

if I xmonad --recompile this is the output:

XMonad will use stack ghc --stack-yaml "/home/dot/.config/xmonad/stack.yaml" to recompile.
XMonad recompiling (forced).
xmonad: stack: runProc: exec: does not exist (No such file or directory)

and

 $ which xmonad
/run/current-system/sw/bin/xmonad

any ideas? I really need to get back to work. :frowning:

Sounds like it wants to use stack to build your xmonad.hs but you don’t have stack installed.

3 Likes

Thanks so much for the quick reply, @ElvishJerricco!!

now I installed stack and this is my output on xmonad --recompile

XMonad will use stack ghc --stack-yaml "/home/dot/.config/xmonad/stack.yaml" to recompile.
XMonad recompiling (forced).
Errors detected while compiling xmonad config: /home/dot/.config/xmonad/xmonad.hs
$ stack build --silent --stack-yaml /home/dot/.config/xmonad/stack.yaml
error: attribute 'ghc822' missing

       at «string»:1:43:

            1| with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc822 git gcc gmp]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = liputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_
             |                                           ^
       Did you mean one of ghc922, ghc884, ghc902, ghc923 or ghc924?
(use '--show-trace' to show detailed location information)

Please check the file for errors.

xmonad: xmessage: executeFile: does not exist (No such file or directory)    

this is the relevant parts of my configuration.nix:


  # List packages installed in system profile. To search, run:
  # $ nix search wget
	environment.systemPackages = with pkgs; [
		neovim
		tmux
		rxvt-unicode
		scrot
		rofi
		qutebrowser
		stalonetray
		xmobar
		xclip
		volumeicon
		faba-mono-icons
		python
		# python2
		python3
		# ZSH
		zsh
		oh-my-zsh
		zsh-nix-shell
		powerline
		# python27Packages.pynvim
		python37Packages.pynvim
		git
		steam
		lastpass-cli
		taskwarrior
		gcalcli
		chromium
		neomutt
#		obs-studio
#		zoom-us
#		racket
#		dropbox
#		inkscape
#		# lilypond stuff
		lilypond
		wmctrl
		timidity
		zathura
#		ghostscript
#		#
#		cowsay
#		nextcloud-client
#		signal-desktop
		feh
#		ranger
		pciutils
		usbutils
#		xfce.xfce4-power-manager # T495 -- enable computer brightness keys
#		pinentry # gives a full-terminal sign in screen, but doesn't give a popup. not sure if I need/want this
#		spotify
		xdotool
		toilet
#		imagemagick
#		# youtube-dl # more up to date with nix-env
#		mpv
#		spotify-tui
#		plover.dev
#		gnumake
#		# QMK stuff
#		avrdude
#		dfu-programmer
#		wget
#		gcc
#		#python27Packages.pip
#		#python37Packages.pip
#		python37Packages.pip-tools
#		#
#		dwarf-fortress
#		dwarf-therapist
#		htop
#		unzip
#		gimp
#		lua
#		# blender
#		powertop
#		yad
#		slack
#		colorpicker
#		nethack
#		rogue
#		lm_sensors
#		home-manager
#		urlview
#		skypeforlinux
#		# notifications
#		libnotify
#		# deadd-notification-center
#		dunst
#		# twmn
#		neofetch
#		weather
#		audacity
#		android-studio
#		gnome.cheese
#		kotlin
#		jdk11
#		entr
		nodejs
#		clinfo
##		# audio
#		supercollider
#		pamixer
#		syncthing
  haskell-language-server

  # If you want you can use `with hpkgs; [` to avoid explicitly
  # selecting into the hpkgs set on every line
  (haskellPackages.ghcWithPackages (hpkgs: [  
    hpkgs.xmobar
    hpkgs.xmonad
    hpkgs.xmonad-contrib
  ]))
  stack
	];
  # Enable xmonad
  services.xserver = {
		enable = true;
		videoDrivers = [ "amdgpu" ];
		windowManager = {
			xmonad = {
				enable = true;
				enableContribAndExtras = true;
				extraPackages = haskellPackages: [
					haskellPackages.xmonad-contrib
					haskellPackages.xmonad-extras
					haskellPackages.xmonad
					haskellPackages.xmobar
				];
			};
		};
		displayManager = {
			lightdm.enable = true;
			defaultSession = "none+xmonad";
			startx.enable = false;
		};
		deviceSection = ''Option "TearFree" "true"'';
	};

I have ghc-9.0.2 on my system. I’m going to do more digging unless somebody has a clear answer. <3

ope! I removed my stack.yaml from my ~/.config/xmonad and I’m good! <3 thanks so much for the tip, @ElvishJerricco !!

FTR record that (quite unhelpful) error message is due to stack trying to pull a GHC version from nixpkgs (via the automatic Nix integration) that has been removed since. The solution for this kind of problem is to either

  • provide a nixpkgs version to stack that still has this GHC version
  • or update the stack resolver to a version that uses a GHC version that is available from nixpkgs.
2 Likes

I actually just stopped it from using stack to build xmonad by renaming stack.yaml to stack.yaml.bak

1 Like