gpt4 book ai didi

nix - 如何 nix-env 安装来自 nix 表达式文件的派生?

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

我有一个 default.nix构建派生的文件(至少我对它的理解)。

{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc864" } :
nixpkgs.pkgs.haskell.packages.${compiler}.callCabal2nix "bhoogle" (./.) {}

我可以成功 nix-build这个。有什么方法可以使用 nix-env 将其安装到我的用户配置文件中吗?直接地?例如类似 nix-env -i -f default.nix .

否则我需要在我的系统配置文件中定义一个包,如下所示:
  example = pkgs.callPackage /home/chris/example/default.nix {};

最佳答案

从字面上看,我最初的猜测(感谢@Robert):

nix-env -i -f default.nix

记录在 nix --help :

   --file / -f path
Specifies the Nix expression (designated below as the active Nix expression) used by the --install, --upgrade, and --query

--available operations to obtain derivations. The default is ~/.nix-defexpr.

       If the argument starts with http:// or https://, it is interpreted as the URL of a tarball that will be downloaded and

unpacked to a temporary location. The tarball must include a single top-level directory containing at least a file named default.nix.

关于nix - 如何 nix-env 安装来自 nix 表达式文件的派生?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56934306/

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