【问题标题】:nix-shell can't find standard attributenix-shell 找不到标准属性
【发布时间】:2020-05-05 19:17:56
【问题描述】:

我正在运行 nixos 19.09 并尝试跟随 instructions 创建一个 ruby​​ 包。但在第一步中,我遇到了一个错误,即找不到 withPackages 属性。

命令: $ nix-shell -p "ruby.withPackages (ps: with ps; [ nokogiri pry ])" --show-trace

结果:

while evaluating the attribute 'buildInputs' of the derivation 'shell' at /nix/store/b6cqdsczmwxfkmc65483x7fgwdl129ar-nixpkgs-19.03.173684.c8db7a8a16e/nixpkgs/pkgs/build-support/trivial-builders.nix:7:14:
while evaluating 'getOutput' at /nix/store/b6cqdsczmwxfkmc65483x7fgwdl129ar-nixpkgs-19.03.173684.c8db7a8a16e/nixpkgs/lib/attrsets.nix:464:23, called from undefined position:
while evaluating anonymous function at /nix/store/b6cqdsczmwxfkmc65483x7fgwdl129ar-nixpkgs-19.03.173684.c8db7a8a16e/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:141:17, called from undefined position:
attribute 'withPackages' missing, at (string):1:94

我猜我以某种方式搞砸了我的 nix 商店,但我不知道如何调试它。

附加信息

$ echo $NIX_PATH
$HOME/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels
$ nix-channel --list
nixpkgs https://nixos.org/channels/nixos-19.03
unstable https://nixos.org/channels/nixos-unstable
$ sudo nix-channel --list
<blank>

【问题讨论】:

  • 看起来您实际上使用的是 19.03。请echo $NIX_PATHnix-channel --listsudo nix-channel --list
  • 有趣。我在 configuration.nix 中离开了system.stateVersion = "19.09"。我粘贴了问题中的输出以获得更好的格式。 @罗伯特亨辛

标签: nix nixos nix-shell


【解决方案1】:

在@RobertHensing 指出我看起来像是在 19.03,并要求我打印出我的频道后,我尝试更新频道列表以指向 19.09 而不是 19.03(使用 nix-channel --add)并修复了它。

【讨论】:

    猜你喜欢
    • 2021-09-29
    • 2017-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-03-04
    • 1970-01-01
    • 2017-11-09
    • 1970-01-01
    相关资源
    最近更新 更多