[Nix-dev] Getting started with cloned nixpkgs: multiple errors and other questions

Kirill Elagin kirelagin at gmail.com
Wed Mar 4 07:03:51 CET 2015


On Tue, Mar 3, 2015 at 5:09 PM Jesse Haber-Kucharsky <
jesse at haberkucharsky.com> wrote:

> I cloned the master branch of github.com/nixos/nixpkgs and set my
> NIX_PATH to point exclusively to the local checkout with "export
> NIX_PATH=/home/jhaberku/src" (nixpkgs exist in the "nixpkgs" directory in
> that location).
>

This way of seting `NIX_PATH` is somewhat outdated as it is not very useful
nowadays, when nixpkgs and nixos are merged into one repo (they used to be
in different repos). Most of the time you really want to use different
syntax: `NIX_PATH=nixpkgs=/home/jhaberku/src/nixpkgs/pkgs` (note that
pointing it to `pkgs` inside the repo is crucial).


> Now, aside from nix complaining about unfree packages and packages marked
> as bad (which I set in my ~/.nixpkgs/config.nix file as directed), I get
> this error all the time:
>
>  $ NIX_PATH=/home/jhaberku/src nix-env -qa firefox
> error: attribute ‘interpreterName’ missing, at
> "/home/jhaberku/src/nixpkgs/pkgs/development/web/nodejs/build-node-package.nix":7:16
>

This part of Nix is a little bit complicated (and I will also take it one
step furrther and say “messy”).
`NIX_PATH` actually has almost no effect on `nix-env` as by default (unless
overriden with `-f`) it takes the expression to evaluate from
`~/.nix-defexpr` (see the “FILES” section of `man nix-env`). So unless you
use `-f` it uses `nixpkgs` from the channel you are using.
But nixpkgs themselves occasionally do `import <nixpkgs>` which _is_
influenced by `NIX_PATH` (see the “ENVIRONMENT VARIABLES” section of `man
nix-env`).
So my best guess is that it is this mixture of different versions of
nixpkgs that causes problems.

So the rule of thumb is to use `-f` with `nix-env` whenever you want to
test something in your local checkout. For some reason I never had problems
using just `-f` without overriding `NIX_PATH` (even though, I believe this
version conflict still takes place but in the opposite direction).


> I checkout out a version of nixpkgs from many days earlier, and had no
> such problem. This leads to me questions:
>
> - Was I doing things the right way? If so, is this just a bug that slipped
> through the radar, or is the master branch regularly broken like this? If
> this is normal for master, how does anyone get anything done if nix-env
> refuses to do anything when a package is broken? If it's not a bug (and an
> error in my configuration), what can I do to fix it?
>

Actually `nix-env` doesn’t refuse to work with broken packages if
everything is set up properly. Tons of errors about broken packages and
other weird stuff is usually a result of it being pointed to a wrong
expression (likely, caused by incorrect `NIX_PATH` in your particular case).


> - I'm running my NixOS installation from the nixos-unstable channel and I
> have some system-level packages specified in /etc/nixos/configuration.nix.
> If I somehow manage to get the master branch of nixpkgs actually working,
> is there any reason why I shouldn't install all my user-level packages from
> my local clone of master with "nix-env -i"? In other words, is it okay that
> the system-wide packages are from a different channel than the user-level
> packages?
>

If you are fine with building everything from source, there shouldn’t be
anything wrong. That’s actually the purpose of Nix/NixOS.


>
> Thanks
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150304/be5a9748/attachment.html 


More information about the nix-dev mailing list