# Understanding nix-channels, nix-env and nix-shell

**URL:** https://discourse.nixos.org/t/understanding-nix-channels-nix-env-and-nix-shell/5693
**Category:** Uncategorized
**Created:** [January 30, 2020, 11:26pm UTC](https://discourse.nixos.org/t/understanding-nix-channels-nix-env-and-nix-shell/5693 "2020-01-30T23:26:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ericbmerritt](https://discourse.nixos.org/user_avatar/discourse.nixos.org/ericbmerritt/32/2061_2.png) [@ericbmerritt](https://discourse.nixos.org/u/ericbmerritt)
#### Post date: [January 30, 2020, 11:26pm UTC](https://discourse.nixos.org/t/understanding-nix-channels-nix-env-and-nix-shell/5693/1 "2020-01-30T23:26:57Z")

</div>

I have a custom nix-channel that I have built. It only has a small set of packages that I have created. I can install these packages just fine with `nix-env -i <package-name>` but I can get `nix-shell` or `nix run` to recognize them. I realize that `nix-env` doesn’t use the NIX\_PATH. However, I can’t figure out how to call nix-shell in a way that gives it access to these packages. That severely limits the usefulness of the channel. I can’t just point `nixpkgs=` in NIX\_PATH to that channel because it only contains a small set of packages, not the entire set of nix packages.

Also note that these are not public packages that can be added to the global nix repo.

So whats the magic incantation for `nix shell` to make these packages available to it?

---

<div class="post-metadata">

### Author: ![danieldk](https://discourse.nixos.org/user_avatar/discourse.nixos.org/danieldk/32/31405_2.png) [@danieldk](https://discourse.nixos.org/u/danieldk)
#### Post date: [January 31, 2020, 7:19am UTC](https://discourse.nixos.org/t/understanding-nix-channels-nix-env-and-nix-shell/5693/2 "2020-01-31T07:19:43Z")

</div>

You could assign it a different name than `nixpkgs`. E.g.:

```plaintext
$ export NIX_PATH=$NIX_PATH:foobar=https://github.com/danieldk/nix-packages/archive/master.tar.gz
$ nix run foobar.citar
$ nix-shell -p '(import <foobar>) citar'

```

There might be a shorter way to do this with `nix-shell`. Though I generally prefer exposing a package set as an attribute through `packageOverrides` over using channels. See:

> **[GitHub - nix-community/NUR: Nix User Repository: User contributed nix...](https://github.com/nix-community/NUR#installation)**
>
> Nix User Repository: User contributed nix packages \[maintainer=@Mic92\] - GitHub - nix-community/NUR: Nix User Repository: User contributed nix packages \[maintainer=@Mic92\]

---

<div class="post-metadata">

### Author: ![layus](https://discourse.nixos.org/user_avatar/discourse.nixos.org/layus/32/125_2.png) [@layus](https://discourse.nixos.org/u/layus)
#### Post date: [January 31, 2020, 1:00pm UTC](https://discourse.nixos.org/t/understanding-nix-channels-nix-env-and-nix-shell/5693/3 "2020-01-31T13:00:32Z")

</div>

Note that with the `nix xxx` family of commands (without the dash) it requires a recent enough version for it to use the channels in NIX\_PATH like this. See ["nix search" duplicate results in brand-new NixOS install. How to fix? - #35 by layus](https://discourse.nixos.org/t/nix-search-duplicate-results-in-brand-new-nixos-install-how-to-fix/5373/35) in particular, completed by the linked pages and the whole discussion.
