> ## Content Index
> Fetch the complete content index at: https://til.codes/llms.txt
> Use this file to discover other available public pages before exploring further.

# nix-shell for elixir projects
- URL: https://til.codes/nix-shell-for-elixir-projects/
- Published: 2020-04-13T07:43:16.000Z
- Updated: 2020-04-13T07:43:16.000Z
- Description: Simple nix-shell to get started with using nix as development environment with Elixir/Phoenix/Rust
- Author: Manu Ajith
- Tags: nix, elixir, #Import 2024-07-13 21:01

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.