Which Elixir version manager are you using? (Poll)

Elixir, Erlang, Ruby, Node – asdf.
Java – jenv.

Haven’t tried switching versions of Go and Rust because their updates are 99% of the time of high quality. :slight_smile: And I prefer to always be on the latest stable version.

OCaml has opam which works very well. I just wish it was less tedious to use, it’s like they are afraid to introduce any convenience and you end up executing 2-4 commands for stuff that should really take one (like have separate environment for every app you are working on; that takes some doing but I’ll hand it to them that it’s possible and works very well!)

2 Likes

asdf also for python, works great.

2 Likes

Nix? Yes, I can write something about it. It is not that hard to be honest, especially in simple cases.

4 Likes

Would you classify Docker as none or other?

I’m thinking other, since technically it’s a way to version control your projects.

It’s what I use for everything.

3 Likes

Really tired of hearing “it’s not that hard”. :021:

We all have different skill sets even if we have one profession around here. So don’t think what comes easy to you is just as easy for others. The reverse examples surely exist as well.

So please, write blog posts. :023: :024: They will be much appreciated.

4 Likes

Thanks to everyone who voted and commented, especially about asdf… I too am now a convert :003:

I really like how simple everything was, well done @HashNuke, @vic, @Stratus3D and everyone who’s worked on it :023:

(If anybody needs a guide on setting up a dev environment on macOS, here’s one I just put up.)

3 Likes

Whenever I can I just grab a package from Fedora/CentOS repo. If the project needs different version I used exenv since have some experience with rbenv.

1 Like

I in person can’t serve with a blog post right now.
But you can have a look at my sample repo → Elixir Nix Seed.
And on any questions, just mail me.

2 Likes

Yes! asdf-erlang uses kerl underneath. Using it allows us to reuse a popular build tool that knows how properly configure Erlang for most popular OSes today. Kerl is an excellent tool and there isn’t anything we could have improved on. The only reasons asdf-erlang exists is to make kerl fit the asdf why of doing things.

4 Likes

I’ve started using Nix recently. The main benefit to me is that your CI environment always matches your development environment, and does it without the overhead and faff of (e.g.) managing docker containers.

The bare minimum for Elixir would be a shell.nix file in the root that looks like this:

{ pkgs ? import <nixpkgs> {} }:

with pkgs;

let
  inherit (lib) optional optionals;

  elixir = beam.packages.erlangR22.elixir_1_9;
  nodejs = nodejs-10_x;
in

mkShell {
  buildInputs = [ elixir nodejs ]
    ++ optional stdenv.isLinux libnotify # For ExUnit Notifier on Linux.
    ++ optional stdenv.isLinux inotify-tools; # For file_system on Linux.

  LOCALE_ARCHIVE = if pkgs.stdenv.isLinux then "${pkgs.glibcLocales}/lib/locale/locale-archive" else "";
}

Then you can run nix-shell to create a prompt with the tools in (I don’t use --pure much as I’m using git etc out of host package manager).

Then in CI, you can start with basic Nix docker image and run nix-env -f shell.nix -i -A buildInputs to get exactly the same environment. This is my full .gitlab-ci.yml file:

image: nixos/nix:latest

variables:
  MIX_ENV: "test"

before_script:
  - nix-env -f shell.nix -i -A buildInputs
  - mix local.rebar --force
  - mix local.hex --force
  - mix deps.get --only test

mix:
  script:
    - mix test
3 Likes

I use kiex and kerl with direnv. I’ve built a little bit of support tooling for direnv for all of this (and I use fish-nvm as I switched to fish).

My preferred Ruby version manager is chruby with ruby-build, although I’m trying to use direnv for a lot of this now.

Afraid not, but it is strictly more powerful :smile:

2 Likes

No formal blog posts (yet) as I burnt myself out on blogging last year, but I do have some verbose participation on our local Nix vs ASDF thread here, two Reddit posts here and here, and an org-mode/org-reveal outline for a lightning-ish talk I gave at work a few years ago here, though Elixir is only mentioned briefly in passing.

Today I’m down to 4 packages installed via Homebrew that I haven’t packaged for Nix myself yet, but with 115 (at work) / 145 (at home) Nix packages provided in my home-manager profile. I install PostgreSQL 10.x or 11.x via nix-darwin, and use an overlay to provide the matrix of Erlang/Elixir versions I used to manage with asdf. I dabble infrequently with nixops and currently build my own Docker base images with Nix as well. Honestly, shell.nix and direnv are the real MVPs, though, as the latter has first-class Nix support. The last piece of language-agnostic Nix tooling I really like is lorri.

Hope that gives anyone curious something to chew on!

7 Likes

I don’t use a version manager at all. I find version managers assume that I want to have several versions of a runtime always installed and all of these are equally valid and important. This is not the case for me at all — I usually want to have the latest stable installed and have others only for “special cases” like specific projects or testing.

I just install the latest stable natively and run other versions via Docker when I need to. This keeps the setup simple because of the perfect isolation and I always know what I’m getting when I type iex or mix. I also don’t need to use a whole separate tool just to wrap my head around runtime versioning.

1 Like

With asdf you do this with asdf global elixir 1.9.4-otp-22. This version will be used everywhere unless you have a project-specific .tool-versions file to override.

4 Likes

I tried this before I was using asdf. The problem was that file system operations are really slow using docker on a mac, when it has to sync files to the docker container and the host when either changes them. When you’re not mounting a file system it does work pretty well though. I use docker locally for running things as local services like databases, caches, queues, etc.

3 Likes