I was wondering how you would use packages from a specific channel (in this case: for Dhall)in a shell.nix file (or using nix-shell -p)? If it can’t be done directly, are there ways to make it work?
I’ve been looking around a bit, but I can’t find any documentation on how to do just this. Any help would be very appreciated!
Background
I started playing around with Dhall the other day, but found that the version in the channel nixos-unstable was too old to have certain features that I wanted: the available version is 1.24, but I need at least 1.27.
Luckily, I found that Dhall has it’s own channel that tracks the master branch.
Now the problem is that I can’t figure out how to use the channel.
The link provides instructions on how to install packages using nix-env, but that doesn’t work because of how I manage my env (using this gist, which forbids nix-env). I also don’t want to install it directly in my environment but use it in nix-shells.
However, I’ve not found any documentation on how to do that or if it is at all possible.
About overlays, how would you organize that if you want everything self-contained within a repo? Have a separate folder where you specify them? I agree that that sounds more distributable and easier to deal with in general.
let
dhall-latest = import (builtins.fetchTarball https://hydra.dhall-lang.org/jobset/dhall-haskell/master/channel/latest/nixexprs.tar.bz2) {};
dhall = dhall-latest.linux-dhall;
because this is “latest” you can’t pinpoint it with hash - you’ll always get latest version (though Nix has caching of impure downloads). But builtins.fetchTarball has a variant with hash.
So after quite a lot of research, I ended up writing a simple overlay for this, which was quite interesting as I’d never worked directly with overlays before.
Right now, I’m fetching a specific version of Dhall: