Programming mostly in Haskell and Julia, and setting up environment with nix
First we need to have nix installed in the computer following the instructions here https://nixos.org/download.html
Then we need to install direnv using nix with the following command nix-env iA nixpkgs.direnv
We are using direnv with .envrc and shell.nix to have nix give us a development environment immediately, as we come into the shell. For this to work we need the following command somewhere in .bashrc or .zshrc, this only needs to be done once per new computer:
eval "$(direnv hook zsh)"
for more information go here: https://direnv.net/docs/hook.html
For every new project we need to have an .envrc file with the content use_nix underneath, and a shell.nix with the environment we want, and the very first time going into that directory we need to run direnv allow
when we rerwite the shell.nix file we need to run direnv reload
Now every time we go into this directory we have access to the environment defined in shell.nix so we can code freely!