[erlang-questions] Using Nix as a package manager

Roger Qiu roger.qiu@REDACTED
Fri Jan 2 18:39:40 CET 2015


Hey all,

I posted this before but it didn't go through.

I saw some discussion on using Nix as a package manager and wanyed to share
some info on Nix.

As some have said Nix of course doesn't currently work on Windows, unless
you use Cygwin.

Most other language package managers when inside a NixOS or Nix system
become hard to use, because they allow mutation. This has meant that the
Nix has to create adapters like cabal2nix or npm2nix... etc. These convert
an appropriate configuration file into a Nix file so it can be used inside
the Nix system.

Nix is of course language independent, so its purpose is far more than just
building language libraries, it can build apps and configure the entire OS
of NixOS.

Some aspects of Nix I've realised over the course of my usage.

The language is a full turing complete functional language. This means
there's more things to learn and understand when it comes to Nix. It is not
at the level of things like JSON or TOML. This of course gives you power at
the cost of less simplicity. However it is a pretty useful language
designed for configuration and manipulating things like attribute sets.

During a build Nix still relies on the internal build scripts of the
particular package. This could mean makefiles and bash files.

I tend to find changing the properties of existing package nix files to be
somewhat difficult. In some cases you can override properties, in others
you pass parameters to the functions, and in other cases you completely
create your package nix file. This problem appears whenever the package
you're building has a lot of different parameters and configuration.

One really cool thing is the concept of the Nix channel. So one could
possibly add all of Erlangs nix files into the erlang channel instead
putting it all into the official nixpkgs channel. Furthermore you also have
build farms which can ship the binary to the OS instead of building it from
source.

Using Nix in development is quite different from using Nix in production.
In development you generally want to be able to mutate the source code
easily, even possibly the source code of your dependencies. But you can't
really do this if you just use Nix normally to install packages. Instead
you have to use Nix in a Nix-Shell or a nix container or build everything
in the current directory.

Some other people who are more expert in Nix might be pitching in later.

This shows the difference of doing dev on Nix vs normal Nix:

http://blog.lastlog.de/posts/nodejs_on_nixos_status/

Thanks,
Roger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150103/0d9ff3ad/attachment.htm>


More information about the erlang-questions mailing list