我想在本地运行nixpkgs测试,我找到this manual,但它不起作用
$ cd my/nixpkgs
$ nix-build --show-trace nixos/tests/login.nix
error: while evaluating the attribute ‘buildCommand’ of the derivation ‘vm-test-run-login’ at /home/bjorn/projects/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘buildCommand’ of the derivation ‘nixos-test-driver-login’ at /home/bjorn/projects/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘buildCommand’ of the derivation ‘nixos-vm’ at /home/bjorn/projects/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘text’ of the derivation ‘run-nixos-vm’ at /home/bjorn/projects/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating anonymous function at /home/bjorn/projects/nixpkgs/pkgs/build-support/closure-info.nix:9:1, called from /home/bjorn/projects/nixpkgs/nixos/modules/virtualisation/qemu-vm.nix:105:13:
assertion failed at /home/bjorn/projects/nixpkgs/pkgs/build-support/closure-info.nix:11:1
因为这个断言
assert builtins.langVersion >= 5;
如何更新langVersion?
$ nix-repl
Welcome to Nix version 1.11.16. Type :? for help.
nix-repl> builtins.langVersion
3
nix-repl>
答案 0 :(得分:0)
向David Grayson致谢
我必须将nixos更新为unstable(sudo nix-channel
很重要)
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
sudo nixos-rebuild switch --upgrade
nix-instantiate --eval -E '(import <nixos> {}).lib.nixpkgsVersion'
nix-instantiate --eval -E 'builtins.langVersion'
答案 1 :(得分:0)
如果您希望在17.09停留一段时间,可以使用此NixOS配置升级Nix:
{ pkgs, ... }: {
nix.package = pkgs.nixUnstable;
}
否则您可能更愿意切换到18.03而不是不稳定。如果您要使用unstable,请确保您使用 nixos -unstable,而不是 nixpkgs -unstable。见https://nixos.wiki/wiki/Nixpkgs#Channels