Skip to content

Instantly share code, notes, and snippets.

@nmaupu
Created November 14, 2024 12:51
Show Gist options
  • Save nmaupu/5b58e2f2eb7b4f205a6c9423127192a5 to your computer and use it in GitHub Desktop.
Save nmaupu/5b58e2f2eb7b4f205a6c9423127192a5 to your computer and use it in GitHub Desktop.
Manual xmonad compilation from source with 'stack'

Manual compilation

mkdir -p ~/.config/xmonad
# Create ~/.config/xmonad/xmonad.hs
cd ~/.config/xmonad
git clone https://github.com/xmonad/xmonad
git clone https://github.com/xmonad/xmonad-contrib
stack init
stack install
cat << EOF > ~/.config/xmonad/build
#!/bin/bash
OUTPUT=xmonad-bin-test
if [ -n "$1" ]; then
  OUTPUT="$1"
fi
exec stack ghc --  \
  --make xmonad.hs \
  -i               \
  -ilib            \
  -fforce-recomp   \
  -main-is main    \
  -v0              \
  -o "$OUTPUT"
EOF
chmod +x ~/.config/xmonad/build
~/.config/xmonad/build

Edit .xprofile

export PATH="$HOME/.local/bin:/home/nmaupu/.ghcup/bin:$PATH"
export XMONAD_CACHE_DIR="$HOME/.config/xmonad"
export XMONAD_CONFIG_DIR="$HOME/.config/xmonad"
export XMONAD_DATA_DIR="$HOME/.config/xmonad"
[...]
exec "$HOME"/.config/xmonad/xmonad-x86_64-linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment