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 ![]()
Edit: pinging @NobbZ 'cause I found a lot of your posts on google ![]()
Marked As Solved
hst337
Also Liked
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
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
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)
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










