Skip to content
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

Building the project on a fresh machine #162

Open
Boarders opened this issue Feb 27, 2020 · 8 comments
Open

Building the project on a fresh machine #162

Boarders opened this issue Feb 27, 2020 · 8 comments

Comments

@Boarders
Copy link
Collaborator

Currently our project can be very painful to build on a fresh machine if it is not easy to grab the correct versions of GHC and cabal. Nix is a package manager for both mac and linux that should, in theory, make this a bit easier as it can grab the relevant version of the compiler for you. We should test whether this makes it easy to build on a fresh machine. The instructions to do so are:

First install nix: this can be done via: curl https://nixos.org/nix/install | sh though the website here also offers tarballs and a way to securely verify the installation.

After that is installed (and perhaps after restarting the shell) one should then be able to run (within the pcg directory):

nix-shell --packages haskell.compiler.ghc881 --run 'cabal install'

This is assuming the version of the compiler we wish to build with is ghc-8.8.1 but can be changed as appropriate so long as the compiler is available from the nix package repository.

@recursion-ninja
Copy link
Collaborator

Let's not assume the user has nix installed or wants it installed it for them. It adds to the user's machine an additional program which was not necessary to build pcg.

stack was our old solution to this issue, but they are no longer viable due to not supporting the newest version of the .cabal file format.

I think a better solution is updating the makefile to query for our ghc and cabal dependencies on the machine and install them when necessary. Related to #127.

@Boarders
Copy link
Collaborator Author

I'm not suggesting here that the default way to build the project is via nix. If nix offers a painless approach to grabbing the correct version of ghc and cabal to quickly build the project then there is no harm in knowing and documenting that regardless of what ultimate solution is preferred for how to build the project.

@ima-hima
Copy link
Collaborator

ima-hima commented Feb 27, 2020 via email

@Boarders
Copy link
Collaborator Author

Boarders commented Mar 13, 2020

I tried this out on a fresh machine without the correct version of GHC or cabal and the following seems to work so long as nix is installed:

nix-shell --packages --pure haskell.compiler.ghc883 haskell.packages.ghc883.cabal-install --run 'cabal update && cabal build'

Note: The use of --pure is just to avoid getting any system versions that might already be installed.

Also worth noting that this will not result in anything being globally installed on the machine.

@wardwheeler
Copy link
Collaborator

wardwheeler commented Mar 13, 2020 via email

@Boarders
Copy link
Collaborator Author

I think so, yes! [with the current exception of Catalina]

@recursion-ninja
Copy link
Collaborator

recursion-ninja commented Mar 15, 2020

I think we should put this in the makefile, both for convenience and a permanent reference.

In the near future, perhaps we can use the nix-shell commands to address #127.

If we rework our make install/bench/test/profile commands to use nix, we might want to also rework the Travis CI script to use invoke commands from the makefile rather than the hard coded set of commands and flags.

@wardwheeler
Copy link
Collaborator

wardwheeler commented Mar 15, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants