How do I build a nix-shell which depends on some unstable packages?


I am attempting to get an environment up and running so I can develop against elm 0.19.0 which is on the unstable channel. I will also need some dependencies from the stable channel - is it possible to have both?

I see one way of using the unstable channel here. Is this good nix style ?

Thank you in advance,


I have not found need to import a particular git revision, but that is one alternative. I usually reference nixpkgs paths defined in NIX_PATH: import <unstable> {} or something.

Is there a reason that either of these would not work? Could you take a package straight out of a nixpkgs channel, packages having dependencies from different nixpkgs versions, or do you need a package from unstable with its dependencies changed to the stable versions, for example?

1 Like

I would recommend fetchFromGitHub as it can download a tarball for the revision instead of pulling the whole repo or fetchTarball with the standard channel url, e.g.

You can import additional channels as local variables e.g. with:

  unstable = import (fetchTarball { };
{ nixpkgs ? import <nixpkgs> {} }:
with nixpkgs; mkShell {
  buildInputs = [ hello unstable.elmPackages.elm ];

This also shows how to get the ‘standard’ tarball. Alternativly you can add channels with nixos-channels or to NIX_PATH. I.e if you’ve added a channel called nixos-unstable you can write in the expr. above (as @atanasi has hinted at)

unstable = <nixos-unstable> {};

Do you need dependencies from stable, build against unstable, or the other way around? I’d have to look that up, but let me know so I can add that later.

1 Like

You also might want to have a look at

1 Like