Following this thread on getting Nix set up on macOS Catalina, there's a few steps involved (assuming you have no /nix
folder):
-
Set up nix folder:
echo 'nix' | sudo tee -a /etc/synthetic.conf
-
Reboot for it to take effect
-
Create an APFS volume for Nix (might need to use a different
diskX
number, checkdiskutil list
for more):sudo diskutil apfs addVolume disk1 APFSX Nix -mountpoint /nix sudo diskutil enableOwnership /nix sudo chflags hidden /nix # Don't show the Nix volume on the desktop echo "LABEL=Nix /nix apfs rw" | sudo tee -a /etc/fstab
-
Install Nix:
sh <(curl https://nixos.org/nix/install) --daemon
At this point, everything works perfectly. However, the nix daemon will fail to start after rebooting. It's simple enough to fix, and I've detailed a workaround in #3125.
We are now ready to set up Miso:
nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use miso-haskell
cd ~/GitHub/Clones # Assumes you have a folder set up for clones
git clone https://github.com/dmjio/miso
cd miso/sample-app
nix-build
open ./result/bin/app.jsexe/index.html
For the recommended development with ag -l | entr sh -c 'cabal build'
, set up the tools via:
nix-env -iA cabal-install entr ag -f '<nixpkgs>'
If you are still inside miso/sample-app
, you can jump into a nix shell with nix-shell -A env
, and then run ag -l | entr sh -c 'cabal build'
.
It's possible to get live reloading and support for ghcid
, by using the sample-miso-jsaddle
app instead. Let's set it up:
cd ~/GitHub/Clones/miso/sample-app-jsaddle
nix-shell --run reload # or build a release with: nix-build -A release
This works by switching between GHC and GHCJS depending on the target.