Shikanime

Shikanime

Lately we have seen a lot of discussion and packages related to packages outside Hex and Beam ecosystem, like ESbuild, Bazel for XLA, binary build caching… Most of the problems were encountered in the Haskell community, which led to the integration of Nix into most of the Haskell tooling.

I think Nix could be a good solution to solve the problem within the Beam community too, on the shoulder of the giant, what do you think?

Nix is a tool that I already use every day for each of my projects, including JVM based, Go, Elixir, Rust, Python and Tensorflow (I prefer it to ASDF because Nix doesn’t need you to understand the build and system library requirements of certain packages such as Python and Erlang).

Long story short, Nix is a Unix distribution agnostic package manager (with cachix as the global build cache), frequently updated (https://repology.org/), that aims to minimize the system scope requirements for building and running application.

Nix: GitHub - NixOS/nixpkgs: Nix Packages collection & NixOS · GitHub
Stack’s Nix integration: https://docs.haskellstack.org/en/stable/nix_integration/
Cabal’s Nix integration: https://cabal.readthedocs.io/en/latest/nix-integration.html

Showing Posts 1 to 10

dimitarvp

dimitarvp

Which problem though?

derek-zhou

derek-zhou

Nix is nice; however, I’d like the BEAM world not to standardize on something outside the scope of BEAM. I don’t even use ASDF; apt + compile from source is good enough for me.

Shikanime

Shikanime OP

The recent example I can think of concerns the XLA binding (GitHub - elixir-nx/xla: Pre-compiled XLA extension · GitHub) which, depending on an environment variable, retrieves a pre-built tar.gz version of the library or rebuilds the library requiring many external components with a specific version of Bazel, Python and Numpy.

Nix solves 2 of the potential problems which are reproducibility by providing build level isolation and build implementation details that do not leaks in the user space. And caching by providing standardized reproductible cache based on hash: Cachix.

https://twitter.com/josevalim/status/1417195238393892868

Another which I didn’t think deeply about is the NodeJS/ESbuild issue, by shifting the system level package from the user to the library provider guaranteed by a declarative and cryptographic hashes of the dependencies (How Nix Works | Nix & NixOS)).

Shikanime

Shikanime OP

I believe, from my experience in production projects (not specifically in Erlang or Elixir) with many people, with many operating systems and with system level dependencies like protoc (Protobuf compiler), protoc-gen-go (Protobuf plugin for Go), Bazel, Go and GCC.

Or a project involving the computation of atmospheric satellite images that depended on Fortran and some system libraries that doesn’t exist on target deployment operating system package manager.

A good enough way is not viable in an environment such as software development, where systemic changes are constant.

This is my point of view and my experience. Please feel free to correct me or challenge my arguments :eyes:

derek-zhou

derek-zhou

There must be some misunderstanding here. I merely say I don’t need it, I never challenged you for whatever setup you prefer for your need. You can already use Nix for what you need to do. You are even welcomed to write a tutorial about how to use Nix to make everything fit together. I only object to make certain setup mandatory.

josevalim

josevalim

Creator of Elixir

Thanks for sharing a possible solution! I have one question: how does it work on Windows and macos? If it doesn’t also have first-class support on those platforms, then it is unfortunately a no-go. :slightly_frowning_face:

webuhu

webuhu

I jive in. There are a good dozen of Nix BEAMers. I’m one of them.
And for projects where needed (projects with external dependencies) it really works like a charme for me.
Even for projects with PosgreSQL I could spin up a development environment with one command.
And with pinning Nixpkgs (the versions used) I’m 100% certain a project will build again in a couple of years without searching for legacy dependency versions.

On excellent macOS support is worked on as far as I know.
Native Windows support is not something that will be finished soon.
As Windows user I use WSL2 for the projects with Nix. Pre WSL2 a had a virtual machine running myself.

So no I don’t see nix getting mainstream soon.
But for me it’s the best thing to get for this kind of dependencies problems.

webuhu

webuhu

What I could see soon, we the community will start writing some guides for developing / deploying with Nix somewhere in our projects.
But I would still wait until Nix flakes are ready.

Shikanime

Shikanime OP

As mentioned by @webuhu, in recent years I have also been looking for a set of tools that are compatible on all operating systems. The Windows side is still the most complicated, even historically no official production grade package manager like APT, Nix or RPM was available, even today… The situation with Winget, chocolatey and scoop is still far from being a good solution.

To my knowledge, Nix does not have first class support for Windows, which I don’t know enough about to discuss in detail, but very good support for Unix-like distributions, including Darwin (MacOS) which I can attest to for years.

dimitarvp

dimitarvp

Taking into account the general direction of the development of Windows itself lately I’d just presume that people will want to use WSL2 and maybe put Nix inside. First-class support of a good package manager becomes less and less likely with time IMO.

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews