Search code examples
xmonad

How to control the environment in which xmonad compiles user config?


Xmonad architecture (as I understand it) allows the compiled executable trigger its own build system so that it can recompile itself and fork.

Does that mean that Xmonad (the desktop environment) must be run with environment appropriate for is build system? That would be unfortunate since all processes would inherit environment specific to building Xmonad.

This would kind-of make sense only if Xmonad used vanilla GHC environment provided by the OS.


Solution

  • If a script called build exists in the configuration directory (usually ~/.xmonad), Xmonad will call it when recompiling (usually triggered by M-q or xmonad --recompile) instead of invoking GHC directly. I suppose that script could construct any environment you want, do the build, and then deconstruct it if needed. Not sure if that's what you're looking for.