我怎样才能 nix-env 从 nix 表达式文件安装派生?
How can I nix-env install a derivation from a nix expression file?
我有一个 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.
我有一个 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.