问题标签 [nix-hydra]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
312 浏览

haskell - 使用 Hydra 测试多个 Haskell 依赖版本

我想使用持续集成来测试我的 Haskell 库及其依赖项的不同版本。有没有一种简单的方法可以用 Hydra ( http://nixos.org/hydra ) 来完成这个任务?

一种解决方案是覆盖感兴趣的依赖项的版本,并将 Nixpkgs 版本用于其他依赖项。但是,我无法弄清楚如何覆盖一个 Haskell 包版本,同时确保使用覆盖的包调用所有其他 Haskell 包。

这是我尝试在release.nix. 引用的 Nix 表达式是使用 cabal2nix 创建的。构建依赖json-assertions,依赖aeson,依赖mtl。由于不使用覆盖的 mtl 调用 aeson,因此表达式指定了 mtl 的两个版本。两个版本的 mtl 导致构建失败。

另一种解决方案是使用公开可用的 Nix 表达式来兼容除 Nixpkgs 中的 Haskell 包集。不过,我还没有找到任何东西。

是否有任何在线项目使用 Hydra 来针对多个版本的依赖项测试 Haskell 包,我可以将其用作示例?

0 投票
1 回答
109 浏览

nix - Nix Hydra 在导入时抛出错误, 其中符号不是

我对 hydra 有一些不完全清楚的事情。以下作业集:

有 2 个构建输入:

  1. ciSrc
  2. nixpkgs

评估没有错误,然后被构建。

但是,当我将工作 expr更改为:

并添加第三个构建输入:

  1. my_package, 本地路径, path/to/package/default.nix

我收到以下错误:

为什么我会得到它?我在这里想念什么?

我的 NIX_PATH 包含<nixpkgs>有效的和<my_package>无效的。这是我所做的唯一会产生错误的更改。

顺便说一句,这两个版本都是由 nix-build 构建的,正如同一台机器上的hydra 手册 和 hydra 使用的同一用户所推荐的那样。

任何人都可以阐明它吗?

0 投票
1 回答
139 浏览

haskell - 使用 Nix 构建 Haskell 包时如何流式传输测试输出?

我有一个在 Hydra 上使用 Nix 构建的项目。当为它运行测试时,它会将日志打印到一个文件中,这使得它们很难从 CI 服务器中查看。有没有办法让项目在测试套件运行时打印标准输出/错误?这是我目前得到的:

0 投票
1 回答
414 浏览

git - 使用 Hydra 构建 Nix 项目时是否可以获得当前的 git SHA?

我正在用 Nix 构建一个 Haskell 项目,CI 由 Hydra 服务器完成。我想做的一件事是将 git SHA 嵌入应用程序本身,这样 SHA 可以包含在我们的异常报告中并作为 HTTP 响应中的标头(以检查最新的服务器是否正在运行)。

使用https://hackage.haskell.org/package/gitrev.git之类的包从我的开发环境中的目录中提取 SHA 很容易,但克隆后 Hydra 似乎没有该目录(我添加了一些模板Haskell 日志记录确认这是错误的)。doesDirectoryExist <PWD>.git

有没有办法以某种方式从 Hydra 获取 git SHA?通过包含 git 目录以便我可以自己获取 SHA,或者以其他方式?

九头蛇版本:SNAPSHOT-b11789f39993c614e53da39c29711b63cd266291(使用nix-2.0.4)

编辑:我还 sshed 到工作服务器并确认没有.git目录存在正在完成构建:

0 投票
0 回答
155 浏览

nix - Nix 如何知道在安装软件包时使用哪个替代品?

交叉发布到 NixOS Discourse

从频道安装或固定 Nixpkgs 时。

假设有shell.nix这样一个:

然后简单地调用它:

然后使用固定版本的 Nixpkgs:

是不是沿着这些思路?

  1. NixOS 组织的 (?) Hydra 构建农场定期构建二进制文件并在频道中发布结果(基于 Nixpkgs 存储库中的分支)

  2. 二进制文件上传到二进制缓存(来自Nix 手册:“二进制文件已构建并上传到 cache.nixos.org 的二进制缓存”)

  3. 当一个进程开始安装一个包(nix-shell,nix-env等)时,Nix 表达式在 Nixpkgs 中查找

  4. 一个推导被构建并放置在 Nix 存储中(?;关键是会有一个哈希值与二进制缓存进行比较

  5. 如果有替代品则拉取,否则源头部署继续。

不同的 deno 版本只是这些快照中包含的不同 Nix 表达式产生不同哈希的结果,因此在每种情况下都下载了不同的替代品。(在第一种情况下,它是在我的笔记本电脑上设置的https://nixos.org/channels/nixos-20.09频道中的最新频道,而后者是从...任何频道中挑选的 - 不稳定? - 有具有该哈希的二进制文件?)

0 投票
1 回答
60 浏览

nix - What is a "jobset" in the parlance of the Hydra continuous integration tool?

I found definitions (see below) and how they are usually used (i.e., a Hydra jobset is tracking a git branch) but I still couldn't figure out what they are in the general sense. Maybe if you could explain it laymen's terms with specific examples?

  • Eelco Dolstra, Eelco Visser: "Hydra: A Declarative Approach to Continuous Integration"

    a specification of the location of a Nix expression, along with possible values for the function arguments of the jobs defined by the Nix expression.

  • NixOS Wiki: "Hydra"

    Job Set

    A list of jobs which will be run. Often a Jobset fits to a certain branch (master, staging, stable). A jobset is defined by its inputs and will trigger if these inputs change, e.g. like a new commit onto a branch is added. Job sets may depend on each other

  • Hydra User's Guide

    3.2 Job Sets

    A project can consist of multiple job sets (hereafter jobsets), separate tasks that can be built separately, but may depend on each other (without cyclic dependencies, of course).

My question may seem pointless after listing all these definitions, but here's an examle to demonstrate my confusion: I looked at the project listing at https://hydra.nixos.org/ and I was under the impression that a project is a channel, and jobsets are the branches in a repo. (I know, there is no mention of "channel" in there, and on the channel page it even says that "Nix channels are not supported by this Hydra server." :) I could fool myself with that when looking at the Hydra project but this argument fell apart when I clicked on the flakes one (that is, couldn't find a supporting github repo, but generally the jobset names didn't feel like branch names).

Also, in the Dolstra/Visser paper, Hydra was set up using SVN; I don't know if SVN even uses branches (mostly because the paper didn't mention them) but this does prove that Hydra can be set up with VCS/SCM other than git where the underlying concepts can be fundamentally different. Again, I could easily be wrong.