Using Nix in Elixir projects

Elixir and Erlang derivations

Top-level Elixir and Erlang derivations

beam.interpreters.*

  • the erlangRxx derivations;
  • erlang as an alias to one of the erlangRxx;
  • the beam.packages.erlang* modules, which group packages built on top of a given Erlang/OTP release;
  • the elixir* derivation as aliases to the beam.packages.erlang.elixir* ones — as you can see, they are built on to the erlang derivation.

beam.packages.*

  • beam.packages.erlang.elixir is the default Elixir version built on top of the default Erlang version. elixir is aliased to it, and it is itself in fact currently an alias to beam.packages.erlang.elixir_1_7;
  • beam.packages.erlangR19.elixir_1_6 is the last Elixir 1.6 version built on top of the last Erlang/OTP 19 version;
  • beam.packages.erlangR21.rebar is the last rebar built on the last Erlang/OTP 21 version.

Building custom derivations

erlangR21_noHipe = erlangR21.override { enableHipe = false; };
# Instead of beam.packages.erlangR21.elixir_1_7, do:
elixir = (beam.packagesWith erlangR21_noHipe).elixir_1_7;
elixir = (beam.packagesWith erlangR21_noHipe).elixir.override {
version = "1.8.0-dev";
rev = "eb069dd43ba98958f4161b070d111f952b1c656c";
sha256 = "0kwqdy75x0xkld1gpzz355h9yw57c6jpq1b7lz7pkn5kxywxn9qb";
};

Standard Elixir projects

Nerves projects

$ sudo $(which fwup) _build/<target>/prod/nerves/images/<app>.fw

Phoenix projects

Working with a local PostgreSQL instance

$ initdb --no-locale --encoding=UTF-8
$ pg_ctl -l "$PGDATA/server.log" start
$ createuser postgres --createdb
$ mix ecto.setup
$ pg_ctl stop
$ killall postgres && pg_ctl -l "$PGDATA/server.log" start

Conclusion

--

--

--

Software Engineer and Film Photographer, passionate about many subjects including Embedded Systems, IT Security, Programming Languages, Music and more.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Slimefun 2020 — Year In Review

Members over the past 6 months

Setting Up a Polkadot Node (the easy way)

Design Patterns for Microservices - Part 01

Towards a Conceptual Model of Object Oriented Programming

Window Dressing: Building UIElements In Unity

Security Cameras Animation (Made with Unity)

Grading Students Solution in Kotlin -HackerRank

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jean-Philippe Cugnet

Jean-Philippe Cugnet

Software Engineer and Film Photographer, passionate about many subjects including Embedded Systems, IT Security, Programming Languages, Music and more.

More from Medium

Accelerate the purchasing 🛍 process in e-commerce based on Shopware 6

Pagination In Lighthouse GraphQL

The merchant list problem: caching frequently-changing aggregate data.

Why Ionic Platform Is The First Choice For Mobile Application Development