nix-shell for elixir projects

I have been using nix as my default development environment for my projects for some time, and have found it quite useful, especially when working with different languages and frameworks and having different version requirements.

Just wanted to share my default nix-shell that I use/modify in the projects.

{ pkgs ? import <nixpkgs> {} }:
  
with pkgs;

let
  inherit (lib) optional optionals;

  erlang = beam.interpreters.erlangR22;
  elixir = beam.packages.erlangR22.elixir_1_10;
  nodejs = nodejs-12_x;
in

mkShell {
  buildInputs = [cacert git erlang elixir cargo nodejs]
    ++ optional stdenv.isLinux inotify-tools
    ++ optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
      CoreFoundation
      CoreServices
    ]);

    shellHook = ''
      alias mdg="mix deps.get"
      alias mps="mix phx.server"
      alias test="mix test"
      alias c="iex -S mix"
    '';
}

Hope that helps someone.! Cheers.