the nix way

On linux, install either jack1 or jack2. JACK support is mostly untested and probably doesn’t work, since I don’t do music on linux. Get in touch if you can help with linux support.

Install nix and cachix. I upload build results to cachix so if you use that you can avoid building them. Of course if you like building you can skip all the cachix steps:

### Standard nix install, skip if you already have nix:
bash <(curl -L https://nixos.org/nix/install)
# On my laptop, nix installed with a max-jobs of 32, which is nuts on a
# laptop with only 4 cores, and totally wedges it up.
# Edit /etc/nix/nix.conf and possibly get max-jobs under control.

### Install cachix, skip if you like building:
nix-env -iA cachix -f https://cachix.org/api/v1/install
# Configure nix to use my cachix cache.
# sudo is necessary because it wants to modify /etc/nix/nix.conf.
sudo cachix use elaforge
# Get nix-daemon to see the new config.  This may be unnecessary if
# you did a single user nix install above:
systemd-linux> sudo systemctl restart nix-daemon
osx> sudo launchctl stop org.nixos.nix-daemon
osx> sudo launchctl start org.nixos.nix-daemon

### Actually do the install:
tools/nix-enter

This will download tons of stuff, and drop you in a subshell where that stuff is available. After this you’ll need to run tools/nix-enter whenever you want to build. I use a special color on PS1 when SHLVL > 1 to indicate the subshell.

This gets the “everything” build including “im” below. Since my build file is a mess, the non-im build is broken and I don’t feel like fixing it at the moment. I’ll probably just make the everything build the only build, now that nix makes it easy.

Now do the rest of the build steps, same as “the traditional way” below:

Ignore the rest of this file!

the traditional way

This is a lot more work than the nix way!

Non-Haskell dependencies

Haskell dependencies

You can do this either the cabal way, or the stack way.

cabal way

For whatever reason cabal doesn’t install binary dependencies automatically, and it doesn’t know how to do dependencies between them, so first run:

# These must be separate command lines!  Cabal is not smart about binaries.
cabal install alex happy
cabal install c2hs cpphs

New cabal with nix-style builds might have fixed this.

To install the needed haskell dependencies, type:

cabal sandbox init  # if you're afraid to screw up your haskell installation
cabal v1-install --only-dependencies

The actual build is with shake, but there’s a dummy cabal file with just dependencies to make install easier.

If you want to build the documentation:

cabal install hscolour
my-package-manager install pandoc

You can also install pandoc with cabal but it has a ridiculous number of dependencies.

stack way

I don’t use stack, but I added some basic support so hopefully this should work:

stack setup # stack.yaml uses 8.4.4
stack install alex happy c2hs cpphs
# Put ~/.local/bin in $PATH if stack warns you about that.
stack install --only-dependencies

From here on, you will need to export use_stack=t. Then when you run bin/mkmk and bin/mk, it will use stack path to find where to get the stack-flavored ghc and packages.

音, Im, Synth

These are all names for the incomplete offline synthesizer. It requires a bunch of extra dependencies. First you need more non-haskell dependencies. Get the -dev versions as usual:

Turn on enableIm in Local.ShakeConfig, and add a bunch more haskell deps:

cd doc/cabal && cabal install --only-dependencies

Or, if you’re doing it the stack way:

cp doc/cabal/all-deps.cabal karya.cabal
vi stack.yaml # uncomment the stuff in there that says to

Misc

tools/run_profile expects ps2pdf in the path, which is part of ghostscript. It’s fine if it’s not, but you’ll get ps instead of pdf. Help with heap profiling would be very welcome!