New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
when using cabal-install-3 to build xmonad, must add --lib
#199
Comments
The right way to use cabal-install in v2+ mode is probably a build script, not |
You could also manually add an entry to ghc environment file( which is usually located at This environment file acts like a reference file for installed package which is located in |
Yes, But using the global env is not recommended. We can Similar: tidalcycles/Tidal#572 . In fact, using the global env for both xmonad and tidal is not working for me (because of conflicting versions for dependencies) |
That's actually not that hard; Lines 681 to 692 in c54e708
I have a #!/bin/sh -e
if [ "$#" != 1 ]; then
>&2 echo "script called with wrong number of arguments"
exit 2
fi
if [ ! -f ./xmonad.hs ]; then
>&2 echo "xmonad.hs not found in current folder"
exit 2
fi
set -x
rm -f xmonad.tmp xmonad.o xmonad.hi
ghc-8.8.3 --make -package-env=xmonad -i -ilib -fforce-recomp -main-is main -O -Wall -v0 xmonad.hs -o xmonad.tmp
rm -f xmonad.o xmonad.hi
strip xmonad.tmp
mv xmonad.tmp "$1" The important bit is the PS: But actually, you don't even need a custom
file and then ...and to answer how to conveniently do this (works with at least cabal 3.2):
This will automatically create a CWD-style GHC package env-file in |
Here's an idea: why don't we make xmonad capture the values of GHC_ENVIRONMENT and GHC_PACKAGE_PATH at the time it's being built, and reuse these when invoking ghc to rebuild the configuration? That should recreate the conditions in which xmonad was being built… It's quite a hack, but is there a better way? xmonad was built in an era when a single global cabal hell^Wenvironment was the norm, so just invoking Would it work? Would it break? |
It would work, but I suggest never touching it with cabal or stack again because they'll both be confused by it having changed out from under them. They both expect to have full control over things in their domain. (Reportedly hvr is gone, so I don't expect a response from him.) Oh, also you can't upgrade any dependencies this way because that will break stack/cabal. |
On second (or maybe third? this has been on the back of my mind for a while) I feel that capturing these variables during build might be too much of a hack. Might be better to test if And for stack, perhaps xmonad might actually learn to deal with that? The new install guide recommends placing stack.yaml in ~/.xmonad, so xmonad can detect that and use
I think this is a misunderstanding. Setting GHC_ENVIRONMENT and GHC_PACKAGE_PATH will only make the xmonad and xmonad-contrib libraries available to ghc, which is then used to compile the xmonad.hs in ~/.xmonad/ that is outside of any cabal project. If you do have a cabal project there, then this doesn't apply to you, as you'll need a build script nevertheless. |
I wasn't really expecting any reply from him. Just wanted to write up my thoughts and possibly gather feedback from other xmonad devs or users. |
Except it has to come from somewhere the first time. |
Dyre detects stack.yaml next to the configuration file and uses it: https://github.com/willdonnelly/dyre/blob/master/CHANGELOG.md |
Related: xmonad#199 Related: xmonad#310
Related: xmonad#199 Related: xmonad#310
Note that the build instructions in INSTALL.md were updated in #314 and the website now also recommends |
And the wiki, sadly, which still recommends running |
This is more a matter of documentation. It cost me some time to debug, so I am noting it here:
If you built xmonad using
cabal-install-3
(with default config file),then
ghci .xmonad/xmonad.hs
, orxmonad --recompile
, produces errors likeThe solution (?) is to un-hide the packages with
cabal install --lib xmonad xmonad-contrib
. Thenghc
picks them up without any-package
options.It seems
cabal-install
v3 currently is under-documented (e.g., https://www.haskell.org/cabal/users-guide/# seems to refer to version 2.4)The text was updated successfully, but these errors were encountered: