snowleopard / hadrian

Hadrian: a new build system for the Glasgow Haskell Compiler. Now merged into the GHC tree!
https://gitlab.haskell.org/ghc/ghc/tree/master/hadrian
MIT License
208 stars 39 forks source link

Make shell.nix less broken #510

Closed sgraf812 closed 6 years ago

sgraf812 commented 6 years ago

I use this setup (minus the hadrianPackages.hadrian line) for building GHC. Using hadrian for the build doesn't work, as nix fails to install shake-0.16 which seems to miss this fix. I'm not too familiar with nix, but I had to manually update the cabal-hashes tarball which breaks every time I nix-channel --update. Last time I tried, it probably broke somewhere else, so I'm just using this file as a base for building GHC HEAD with make.

snowleopard commented 6 years ago

@sgraf812 Thank you! I don't use nix, so I cannot properly review this PR.

@angerman @mpickering Perhaps, you could have a look?

snowleopard commented 6 years ago

By the way, is there a CI service for nix? If yes, we could add it to our CI suite.

mpickering commented 6 years ago

I don't understand the nativeBuildInputs change. The rest I also have locally (woops).

There is also a problem with the script currently that it overrides mk/build.mk. You have to run configurePhase to set the right flags and then copy mk/build.mk and append DYNAMIC_GHC_PROGRAMS=YES.

https://github.com/NixOS/nixpkgs/issues/34485

sgraf812 commented 6 years ago

Re: nativeBuildInputs change. If I change it back to buildInputs, I get this error:

$ config_args=$configureFlags ./validate
...

----------------------------------------------------------------------
Configure completed successfully.

...

   Tools to build Sphinx HTML documentation available: NO
   Tools to build Sphinx PDF documentation available: NO

...

===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
ghc.mk:175: *** BUILD_SPHINX_HTML=YES, but `sphinx-build` was not found. Create a file `mk/validate.mk` containing `BUILD_SPHINX_HTML=NO` (when validating), or install `sphinx-build` and rerun `./configure`. See https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation.  Stop.
make: *** [Makefile:123: all] Error 2

This error doesn't happen for nativeBuildInputs, which is how the other build dependencies in ghcHEADs derivation seems to be specified.

mpickering commented 6 years ago

OK -- seems sensible. I say merge this if it works for you.

snowleopard commented 6 years ago

Thanks @mpickering!

@sgraf812 Shall I merge, or would you like to make any further tweaks?

sgraf812 commented 6 years ago

Although it doesn't quite build hadrian yet, I think it's a strict improvement, so we can merge this.

If my nix foo was stronger, I could probably rig some overlay together that fetches all-cabal-hashes and depends on a version of shake that works with directory, but the grass is always greener.

snowleopard commented 6 years ago

@sgraf812 Done. Thank you!

mpickering commented 6 years ago

@sgraf812 What do you think about pinning the version of nixpkgs in the shell.nix file?

sgraf812 commented 6 years ago

That would definitely help. Or rather make builds reproducible.

But the shake breakage I was referring to was due to a name clash with directory process-1.6.3.0 that was fixed only recently. We can't just depend on shake-0.16.2, which is a release that includes the fix, because of the slow tracking of all-cabal-hashes in nixpkgs. I guess a combination of fixing the nixpkgs release + fixing all-cabal-hashes + fixing all dependencies on hackage would help.

alpmestan commented 6 years ago

Note that I have a few variations on the shell.nix, including one with which I can build and use hadrian. I do have to clean all of this up before I make a PR though. One of these days, if someone doesn't beat me to it, I'll take care of writing a nix expression that supports a bunch of options (llvm packages or not, using hadrian or make, docs dependencies or not, etc), I've just been busy with more important things lately. Thanks in the meantime for this @sgraf812!