更新nix包中的依赖项(Updating the dependencies in a nix package)

编程入门 行业动态 更新时间:2024-10-28 09:21:44
更新nix包中的依赖项(Updating the dependencies in a nix package)

目前使用的是Mac OS X上的nix频道提供的Elixir版本。该软件包是使用Erlang 18构建的:

$ iex --version Erlang/OTP 18 [erts-7.3.1.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] IEx 1.4.2

我想更新程序包以使用Erlang 19.使用更新的依赖项在nix中重建包的最直接方法是什么?

Currently using the version of Elixir provided by the nix channel on Mac OS X. The package was built with Erlang 18:

$ iex --version Erlang/OTP 18 [erts-7.3.1.2] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] IEx 1.4.2

I'd like to update the package to use Erlang 19. What's the most straightforward means of rebuilding a package in nix with updated dependencies?

最满意答案

通过将以下包覆盖添加到~/.nixpkgs/config.nix我能够得到一个解决方案:

{ packageOverrides = pkgs: rec { elixir = pkgs.elixir.override { erlang = pkgs.erlangR19_odbc_javac; }; rebar = pkgs.rebar.override { erlang = pkgs.erlangR19_odbc_javac; }; }; }

覆盖elixir包不足以使构建工作,因为构建工具钢筋也是使用Erlang 18构建的。一旦指定了,我运行了nix-env -i elixir并且使用了两个软件包的源来下载和构建二郎19。

一个警告:即使对config.nix nix进行了这些更改,也坚持要下载Erlang 18软件包。 但是,这实际上并没有在构建中使用,并且在运行nix-collect-garbage -d被删除。 螺纹钢和酏剂衍生物都没有参考包装,所以原因仍然是个谜。

感谢@ zimm-i48参考相应的nix文档。 同样有用的是Luca Bruno在nix上发布的一系列博客:

http://lethalman.blogspot.it/2014/07/nix-pill-7-working-derivation.html

I was able to arrive at a solution by adding the following package overrides to ~/.nixpkgs/config.nix:

{ packageOverrides = pkgs: rec { elixir = pkgs.elixir.override { erlang = pkgs.erlangR19_odbc_javac; }; rebar = pkgs.rebar.override { erlang = pkgs.erlangR19_odbc_javac; }; }; }

Overriding the elixir package wasn't sufficient to get the build working, as the build tool rebar was also built using Erlang 18. Once that was specified, I ran nix-env -i elixir and the source for both packages was downloaded and built using Erlang 19.

One caveat: even with these changes to the config.nix nix insisted on downloading the Erlang 18 package. However, this wasn't actually used in the build and was removed on running nix-collect-garbage -d. Neither the rebar nor the elixir derivatives referenced the package so the cause remains a mystery.

Thanks to @zimm-i48 for the reference to the appropriate nix documentation. Also useful was Luca Bruno's series of blog postings on nix:

http://lethalman.blogspot.it/2014/07/nix-pill-7-working-derivation.html

更多推荐

本文发布于:2023-07-22 07:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1217939.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:包中   nix   Updating   package   dependencies

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!