如何使用nix-env -i all
通过~/.nixpkgs/config.nix
从不稳定的频道安装软件包?
答案 0 :(得分:2)
在~/.nixpkgs/config.nix
的开头添加以下部分:
let unstable = import <nixpkgs> {}; in
nixpkgs
是不稳定通道的名称(请通过nix-channel --list检查其名称)。
并使用unstable.
在不稳定的情况下为要安装的软件包添加前缀。
示例-还可以访问不稳定对象,以用于nix-env -i
:
let
config = {
allowUnfree = true;
packageOverrides = pkgs: with pkgs;
let jdk = openjdk11; in rec {
unstable = import <nixpkgs-unstable> { inherit config; };
all = pkgs.buildEnv {
name = "all";
paths = [
htop
nox
nix-info
nix-index
haskell.compiler.ghc864
haskellPackages.cabal-install
unstable.haskellPackages.stack
haskellPackages.hoogle
haskellPackages.ghcid
unstable.haskellPackages.cabal2nix
];
};
};
};
in config
或者您也可以这样做:
let unstable = import <nixpkgs> {}; in
{
allowUnfree = true;
packageOverrides = pkgs_: with pkgs_;
let jdk = openjdk11; in {
all = with pkgs; buildEnv {
name = "all";
paths = [
htop
nox
nix-info
nix-index
haskell.compiler.ghc864
haskellPackages.cabal-install
unstable.haskellPackages.stack # this comes from the unstable channel
haskellPackages.hoogle
haskellPackages.ghcid
unstable.haskellPackages.cabal2nix
];
};
};
}