nix-env with locally installed nixpkgs

844 views
Skip to first unread message

Klaas van Schelven

unread,
Sep 8, 2017, 6:18:07 AM9/8/17
to nix-...@googlegroups.com
Hello,

I'm running a NixOS setup without channels, and with a locally installed checkout of nixpkgs. 
This makes contributing changes to nixpkgs easier, and allows for more explicit control of upgrades on the underlying channel, i.e. those happen precisely when I do a git pull on my local clone.

Rebuilding my system is then done like so:
nixos-rebuild switch -I nixpkgs=path-to-git-repo

I can't manage to figure out how to get nix-env to work in this setup though. 

Example:
nix-env -i bash -I nixpkgs=path-to-git-repo
error: selector ‘bash’ matches no derivations

Thanks,
Klaas

Linus Heckemann

unread,
Sep 8, 2017, 6:19:05 AM9/8/17
to nix-...@googlegroups.com
Hi Klaas,

Try nix-env -f path-to-git-repo -iA bash.

Linus

Matthew O'Gorman

unread,
Sep 8, 2017, 6:29:17 AM9/8/17
to Klaas van Schelven, nix-devel
You are looking for  nix-env -f ${path-to-git-repo} -i bash

for more info

https://nixos.org/nixos/manual/index.html#sec-getting-sources

Good luck

Mog

--
You received this message because you are subscribed to the Google Groups "nix-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nix-devel+unsubscribe@googlegroups.com.
To post to this group, send email to nix-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nix-devel/CACu42%2B411NTHQty9tiCvqW2WKdrUM6xqQezQCv7AiuecXh%2BfQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Klaas van Schelven

unread,
Sep 8, 2017, 6:36:50 AM9/8/17
to nix-devel
Thanks Linus & Matthew!

Peter Simons

unread,
Sep 8, 2017, 7:51:16 AM9/8/17
to Klaas van Schelven, nix-...@googlegroups.com
Hi Klaas,

> nix-env -i bash -I nixpkgs=path-to-git-repo
> error: selector ‘bash’ matches no derivations

I use the following setup:

$ cd $HOME
$ rm -r .nix-defexpr
$ git clone git://github.com/NixOS/nixpkgs.git .nix-defexpr

Now ensure that

NIX_PATH="nixpkgs=$HOME/.nix-defexpr"

is set (i.e. in your ~/.bashrc), and then all Nix commands will use your
local checkout without further ado.

Best regards,
Peter
Reply all
Reply to author
Forward
0 new messages