安装Elixir或Erlang>的规范方法是什么? 19在非NixOS系统上使用`nix`吗? [英] What is the canonical way of installing Elixir or Erlang > 19 with `nix` on a non-NixOS system?

查看:78
本文介绍了安装Elixir或Erlang>的规范方法是什么? 19在非NixOS系统上使用`nix`吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从在非NixOS机器上安装Nix软件包管理器的那一刻起,请向10岁的孩子解释一下。例如,我在Mac上,甚至没有〜/ .config 目录。

Please explain it as you would to a 10-year-old, from the point after the Nix package manager is installed on a non-NixOS machine. For example, I am on a Mac, and there isn't even a ~/.config directory.

我发现以下内容(可能)相关资源,而我无法将各个部分放在一起:

I found the following (probably) relevant resources, and I can't put the pieces together:

在NixOS 18.03上使用Erlang 20.0的Elixir 1.5.1?

我在哪里指定 beam.packages.erlang< rel> .elixir 到底是什么?

Where do I specify the beam.packages.erlang<rel>.elixir exactly?

Nixpkgs手册,6.4。通过packageOverrides修改软件包

Nix Pills,第14章。覆盖设计模式

这需要这个吗?

最后,我安装了带有Erlang 21的最新Elixir,如下所示,但我确定

In the end I installed the latest Elixir with Erlang 21 as shown below, but I'm sure that this is not how it is supposed to be done.

$ # Cloned the `nixpkgs` repo from github and started the repl
$ # in the same the directory.
$
$ nix repl
Welcome to Nix version 2.0.4. Type :? for help.

nix-repl> :l .   # if in the cloned `nixpkgs` repo
Added 9182 variables.

nix-repl> pkgs.beam.packages.erlangR21.elixir
«derivation /nix/store/vcadn6d6wgk1yjlci458vy8jqv66wwdy-elixir-1.6.5.drv»

nix-repl> :q

$ nix-store --realise /nix/store/vcadn6d6wgk1yjlci458vy8jqv66wwdy-elixir-1.6.5.drv


推荐答案

您在正确的轨道上;

要从 nix repl 安装软件包,可以使用:i 命令。

To install the package from nix repl you can use the :i command.

nix-repl> :i pkgs.beam.packages.erlangR21.elixir

这会将软件包安装到您的〜/ .nix配置文件,它将位于 $ PATH 中,因此您可以调用它。等效于运行

This will install the package into your ~/.nix-profile where it will be in $PATH, so you can call it. It is equivalent to running

nix-env -iA nixpkgs.beam.packages.erlangR21.elixir

nix-store -r (或等价的 nix-store --realise )被认为是非常底层的工具。它只能创建到包的符号链接,而这几乎是您所不想要的。默认情况下,它甚至不会创建垃圾回收根,因此,如果您进行垃圾回收,符号链接将被破坏。

nix-store -r (or equivalently, nix-store --realise) is considered a very low-level tool. It can only create a symlink to a package and that is rarely what you want. It doesn't even create a garbage collection root by default, so if you garbage collect, the symlink will become broken.

尽管 nix-env -iA 是安装软件的有效方法,您可以考虑〜/ .nix-profile 全局状态,并避免这种状态。在我看来, elixir 与项目而不是与您的用户紧密相关。例如,您可能想为某些项目使用不同的版本,并且与从事该项目的其他人共享您的开发工具可能很有意义。也就是说,您可以使用 nix-shell 。这是一个 shell示例.nix。

Although nix-env -iA is a valid way of installing software, you may consider ~/.nix-profile global state and avoid it for that reason. It seems to me like elixir that is more tied to a project, rather than to your user. For example you may want to use distinct versions for some projects and it may make sense to share your development tools with others who work on a project. That is you can use nix-shell for. Here's an example of shell.nix.

这篇关于安装Elixir或Erlang&gt;的规范方法是什么? 19在非NixOS系统上使用`nix`吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆