我正在尝试实现一个简单的声明性包管理解决方案。
我在virtualbox上安装了一个干净的nixos(感谢this vagrant solution)
我正在关注the following subsection in the nixos manual
我做
mkdir -p ~/.config/nixpkgs/
vi ~/.config/nixpkgs/config.nix
这样cat ~/.config/nixpkgs/config.nix
现在会给出:
{
packageOverrides = pkgs: with pkgs; {
myPackages = pkgs.buildEnv {
name = "my-packages";
paths = [ aspell bc coreutils gdb ffmpeg nixUnstable emscripten jq nox silver-searcher ];
};
};
}
现在,
nix-env -iA nixpkgs.myPackages
输出:
error: attribute ‘nixpkgs’ in selection path ‘nixpkgs.myPackages’ not found
我也试过
nix-env -f. -iA nixpkgs.myPackages
nix-env -iA nixos.myPackages
nix-env -f. -iA nixos.myPackages
所有人都失败了。
nixos中包声明的简单示例是什么?在这种情况下,似乎它试图为给定用户实现安装的某组软件包。我不介意适用于所有用户的声明,但更喜欢给定用户的某些内容(以备将来使用)。
编辑:这是尝试获取nix-info
时的输出[vagrant@nixbox:~]$ nix-shell -p nix-info --run nix-info
error: undefined variable ‘nix-info’ at (string):1:66
(use ‘--show-trace’ to show detailed location information)
[vagrant@nixbox:~]$ nix-shell -p nix-info --run nix-info --show-trace
error: while evaluating the attribute ‘nativeBuildInputs’ of the derivation ‘shell’ at /nix/store/5cd5ac78p0yy47yi5ml12s690bl5lsh8-nixos-16.09.1389.d7a3160/nixos/pkgs/build-support/trivial-builders.nix:10:14:
while evaluating ‘optionals’ at /nix/store/5cd5ac78p0yy47yi5ml12s690bl5lsh8-nixos-16.09.1389.d7a3160/nixos/lib/lists.nix:185:21, called from /nix/store/5cd5ac78p0yy47yi5ml12s690bl5lsh8-nixos-16.09.1389.d7a3160/nixos/pkgs/stdenv/generic/default.nix:204:16:
while evaluating ‘chooseDevOutputs’ at /nix/store/5cd5ac78p0yy47yi5ml12s690bl5lsh8-nixos-16.09.1389.d7a3160/nixos/lib/attrsets.nix:463:22, called from /nix/store/5cd5ac78p0yy47yi5ml12s690bl5lsh8-nixos-16.09.1389.d7a3160/nixos/pkgs/stdenv/generic/default.nix:161:22:
undefined variable ‘nix-info’ at (string):1:66
[vagrant@nixbox:~]$