[Nix-dev] newbie question: Which name is used for eclipse-sdk-4.4 in /etc/nixos/configuration.nix

Bjørn Forsman bjorn.forsman at gmail.com
Tue Jan 6 22:12:55 CET 2015


On 6 January 2015 at 21:29, Niklaus Giger <niklaus.giger at member.fsf.org> wrote:
> Hi everybody
>
> Thanks to lwn pointing me to NixOS I decided to test drive using VirtualBox. I
> was quite impressed how much was available and how smooth my experience has
> been.

Great!

> I am puzzleed that runnig
> nix-env -i eclipse-sdk-4.4
> works fine, but I was unable to add it /etc/nixos/configuration.nix with lines
> like
> {
>   environment.systemPackages =
>     [ pkgs.eclipse-sdk-4.4
>         ]
> }
> failed.
>
> Similarly I was surprised that nix-env -i kdepim needed a item called
> pkgs.kde4.kdepim in /etc/nixos/configuration.nix.
>
> Could anybody point give me an explanation or point me to where I find one for
> this behaviour? I did not find one under https://nixos.org/wiki/FAQ,
> http://nixos.org/nix/manual/ nor http://nixos.org/nixpkgs/manual/.

It's due to the fact that packages can be installed by "attribute
name" or "package name". nix-env -i installs by package name, nix-env
-iA and environment.systemPackages installs by attribute name.

(Unfortunately I don't know a good reference to point to for a
description of this.)

A comment above the environment.systemPackages line, in the
configuration.nix template created during installation, should at
least give you an example command for finding packages: "nix-env -qaP
| grep wget"

In general, we try to keep the package attribute equal to the package
name. Not so long ago, nix didn't support dashes in attribute names
(it confliced with the 'subtraction' operator), so there are packages
still using attribute names with camelCase or underscore instead of
dash.

Also, some packages are grouped under "container attributes", like you
saw above ("kde4").

Just use "nix-env -qaP | grep wget" and you'll be OK.

Best regards,
Bjørn Forsman


More information about the nix-dev mailing list