我有一个default.nix构建派生的文件(至少我对它的理解)。
{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc864" } :
nixpkgs.pkgs.haskell.packages.${compiler}.callCabal2nix "bhoogle" (./.) {}
Run Code Online (Sandbox Code Playgroud)
我可以成功nix-build这个。有没有办法可以nix-env直接将其安装到我的用户配置文件中?例如类似的东西nix-env -i -f default.nix。
否则我需要在我的系统配置文件中定义一个包,如下所示:
example = pkgs.callPackage /home/chris/example/default.nix {};
Run Code Online (Sandbox Code Playgroud)
Chr*_*ski 10
从字面上看,我最初的猜测(感谢@Robert):
nix-env -i -f default.nix
Run Code Online (Sandbox Code Playgroud)
记录在nix --help:
Run Code Online (Sandbox Code Playgroud)--file / -f path Specifies the Nix expression (designated below as the active Nix expression) used by the --install, --upgrade, and --query-- 可用的操作来获得派生。默认是 ~/.nix-defexpr。
Run Code Online (Sandbox Code Playgroud)If the argument starts with http:// or https://, it is interpreted as the URL of a tarball that will be downloaded and解压到一个临时位置。tarball 必须包含一个顶级目录,其中至少包含一个名为 default.nix 的文件。