Onor.io

Onor.io

Nix Flake Template for Elixir?

I apologize in advance if I am posting this in the wrong place.

I see a nix package for Elixir (in fact I see several). Big kudos to those folks who have taken the time to do this!

I want to create a nix flake for an Elixir app I’m working on and I can create a plain old nix flake but I was wondering if someone has already created a nix flake template for Elixir? Googling hasn’t turned up anything (although I may be using the wrong search terms).

Most Liked

shanesveller

shanesveller

I maintain some OSS Nix<->BEAM tooling, which offers flake init templates, support for ingesting asdf .tool-versions files, reusable dev shells and a few other niceties, based on flake-parts lib. Repo is here and feedback or critiques are welcome. Example usage is also documented here.

I’ve been iterating and daily driving it for a couple years at this point, and haven’t had asdf/mise/rtx installed at all in the last 18 months or so.

c4710n

c4710n

Hey, @Onor.io. Very happy to see that you like Nix.

After the post mentioned by @zimt28, my workflow improved a lot. If you continue to use Nix, I believe you will encounter some issues, like:

  1. How to init a project quickly?
  2. How to package an Elixir app as a Nix derivation?
  3. How to package an Elixir app as a Docker image with Nix?

I really like building Docker image with Nix Flake - I don’t have to sync .dockerignore with .gitignore anymore.

All above problems already have solutions, I hope the following links are also useful to you in the future.

  1. using Nix template: You can create your own nix-dev-template by following the-nix-way/dev-templates or c4710n/nix-dev-templates, etc.
  2. Check out nix-dev-templates/elixir/phoenix/nix/release.nix at 8c8ed3b805c043e2666124fa2b4e22067ca1d0df · nix-giant/nix-dev-templates · GitHub.
  3. Check out nix-dev-templates/elixir/phoenix/flake.nix at 8c8ed3b805c043e2666124fa2b4e22067ca1d0df · nix-giant/nix-dev-templates · GitHub
zimt28

zimt28

Last Post!

onnimonni

onnimonni

Hey and sorry for visiting an old topic but this came to the top when searching for “nixos elixir” with Google.

Are there any public examples of using flakes to locally develop and to deploy an elixir based application to Nixos?

I’m using my own bare metal server to run this but using docker is alright too.

Where Next?

Popular in Questions Top

Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
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
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
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
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
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
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
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

We're in Beta

About us Mission Statement