lud

lud

How to get Elixir to use OTP-25 in NixOs

Hi,

I’m trying NixOS these days, and while I love the principle, I think it leads to duplication of installed packaged and dependencies:

With this configuration:

{ pkgs, ... }:
{

  nixpkgs.overlays = [
    (self: super: {
      erlang = (super.erlang.override {
        version = "25.3";
        sha256 = "UOBrDaXpvpeM79VN0PxVQ1XsYI+OYWBbaBfYE5lZXgE=";
      });
    })
  ];

  environment.systemPackages = with pkgs; [
    
    # ...

    erlang
    elixir_1_14
  ];
}

I get the following in my shell:

[lud@nixos:~]$ erl
Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

[lud@nixos:~]$ elixir --version
Erlang/OTP 24 [erts-12.3.2.5] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit]

Elixir 1.14.2 (compiled with Erlang/OTP 24)

I can hack the same kind of override for elixir, but nix only let me override the argumens for the function defined here

But the erlang package is defined in the higher scope.

I thought I had found the asdf killer but know I doubt :smiley:

Edit: pinging @NobbZ 'cause I found a lot of your posts on google :slight_smile:

Marked As Solved

hst337

hst337

Also Liked

hst337

hst337

I use this in my shell

{ pkgs ? (import <nixpkgs> {}), ... }:
with pkgs;
let
  otp = beam.packages.erlangR25;
  basePackages = [
    otp.elixir_1_13
  ];
  # Hot reloading stuff
  inputs = basePackages ++ lib.optionals stdenv.isLinux [ inotify-tools ]
    ++ lib.optionals stdenv.isDarwin
    (with darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]);
in pkgs.mkShell {
  buildInputs = inputs;

  # keep your shell history in iex
  ERL_AFLAGS = "-kernel shell_history enabled";

  shellHook = ''
    # this isolates mix to work only in local directory
    mkdir -p .nix-mix .nix-hex
    export MIX_HOME=$PWD/.nix-mix
    export HEX_HOME=$PWD/.nix-hex

    # make hex from Nixpkgs available
    # `mix local.hex` will install hex into MIX_HOME and should take precedence
    export MIX_PATH="${otp.hex}/lib/erlang/lib/hex/ebin"
    export PATH=$MIX_HOME/bin:$HEX_HOME/bin:$PATH
  '';
}
hauleth

hauleth

While I like Scheme, I personally find Guix derivations harder to read than Nix. Also almost hostility towards non-free packages (in FSF sense) and host systems make Guix no-go zone for me.

For me FSF approach towards the software is on the “absurd” side of the spectrum, just like Oracle or Nintendo is on the exact opposite of spectrum in the “absurd” region.

Idea is glorious, but execution - not much. I am happy user of Nix on Darwin and while I always wanted to try Guix, their community and approach to people with other requirements/goals is something that keeps me out of it. Fortunately Nix is learning their lesson and they are fixing CLI into more useable and manageable form.

lud

lud

Alright so the following seems to work in the nix config:

    beam.packages.erlangR25.elixir_1_14
    beam.packages.erlangR25.erlang
    beam.packages.erlangR25.hex

Now how did you know there was a beam package?

On the website, the beam seems to be a haskell thing : NixOS Search (2nd- result)

lud

lud

Well I wonder why I never went into that with that many google searches but thanks :smiley:

tj0

tj0

Unrelated, but you might like guix. It’s the same principles as nix, but comprehensible.

Where Next?

Popular in Questions Top

lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement