Setting up Agda via nix on osx, running hello world
Setting up Agda on OSX is not straight-forward, some haskell modules are required and some agda modules are required.
We can of course install these globally, but this pollutes our global namespace.
Alternatively we can use
nix-shell to give us a sandboxed environment to use
nix on OSX.
Next we want an environment with
We can use
nix-shell for this.
We provide a
shell.nix file that tells
nix-shell what it needs to setup.
shell.nix should contain dependencies and
Agda standard library
Haskell ieee library
Looking them up via nixpkgs, their attributes are:
agda available to us as a
binary so we use
name = "agda-with-stdlib";
buildInputs = [ pkgs.haskellPackages.Agda];
AGDA_DIR = agdaDir;
We also want
ghc used in compiling
agda programs to have
agdaGhc = pkgs.haskellPackages.ghcWithPackages (
haskellPackages: [ pkgs.haskellPackages.ieee ]
The end result can be seen in this gist
References: @ryanrendorff - gist