gpt4 book ai didi

Nix 和 Haskell-ng 安装错误 : attribute ‘nixpkgs’ in selection path ‘nixpkgs.haskellEnv’ not found

转载 作者:行者123 更新时间:2023-12-04 18:38:14 26 4
gpt4 key购买 nike

我正在关注 this设置 nix 和 haskell-ng 的指南。但是当我走到这一步

nix-env -iA nixpkgs.haskellEnv



然后我得到错误:

error: attribute ‘nixpkgs’ in selection path ‘nixpkgs.haskellEnv’ not found



知道出了什么问题吗?

最佳答案

命令 nix-env -f "<nixpkgs>" -iA haskellEnv应该管用。

引用自 http://nixos.org/nixpkgs/manual/#users-guide-to-the-haskell-infrastructure :

Attribute paths are deterministic inside of Nixpkgs, but the path necessary to reach Nixpkgs varies from system to system. We dodged that problem by giving nix-env an explicit -f "<nixpkgs>" parameter, but if you call nix-env without that flag, then chances are the invocation fails:

$ nix-env -iA haskellPackages.cabal-install
error: attribute ‘haskellPackages’ in selection path
‘haskellPackages.cabal-install’ not found

On NixOS, for example, Nixpkgs does not exist in the top-level namespace by default. To figure out the proper attribute path, it's easiest to query for the path of a well-known Nixpkgs package, i.e.:

$ nix-env -qaP coreutils
nixos.coreutils coreutils-8.23

If your system responds like that (most NixOS installations will), then the attribute path to haskellPackages is nixos.haskellPackages. Thus, if you want to use nix-env without giving an explicit -f flag, then that's the way to do it:

$ nix-env -qaP -A nixos.haskellPackages
$ nix-env -iA nixos.haskellPackages.cabal-install

关于Nix 和 Haskell-ng 安装错误 : attribute ‘nixpkgs’ in selection path ‘nixpkgs.haskellEnv’ not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30952053/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com