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)

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&amp;query=perfume&amp;page=2, I would like to get: ...
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
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: &lt;h1&gt;Create Post&lt;/h1&gt; &lt;%= ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement