Trying to obtain a package from unstable

Hello all,

I feel like there’s something important about Nix that I’m not understanding. I have a fairly simple shell.nix:

{ pkgs ?  import <nixos> {} }:
let
  unstable = import (fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz) {};
in pkgs.mkShell {
  name = "clash-compiler-shell";
  buildInputs = with unstable.haskellPackages; [
    clash-ghc

    ghc-typelits-natnormalise
    ghc-typelits-knownnat
    ghc-typelits-extra
  ];
}

What I’m trying to do here is to coerce the shell to use the version of clash-ghc that’s on unstable, rather than nixos. According to the package search engine, this should be version 1.4.3. When I enter the shell, though, and do clash --version, I get told I’m on 1.2.4, which is the version on the nixos channel. So it seems the shell is for some reason still choosing an older derivation that I have installed. Am I somehow not being specific enough? Or should I try to update the package using nix-env? It feels like there should be a way to specify this declaratively.

Thanks in advance for any help.

it looks fine. You can do which clash to see if your outer environment is bleeding into the shell.

I would do nix-shell --pures to see if impurities are causing the old version to still be present.

OK, thank you. There actually isn’t a clash outside of the shell, so I guess that’s not the problem. Perhaps the version on unstable is just mis-labelled as regards version number. As long as I’m not making some bigger mistake, I don’t really mind about this particular case.

Well, if it makes you feel better, it’s currently broken anyway:

$ nix run github:nixos/nixpkgs/nixos-unstable#haskellPackages.clash-ghc -- --version
error: Package ‘clash-prelude-1.4.3’ in /nix/store/z7qikyiq6zfhxc7k7721z3zcrlpxy9s6-source/pkgs/development/haskell-modules/hackage-packages.nix:56267 is marked as broken, refusing to evaluate.

       a) To temporarily allow broken packages, you can use an environment variable
          for a single invocation of the nix tools.

            $ export NIXPKGS_ALLOW_BROKEN=1

       b) For `nixos-rebuild` you can set
         { nixpkgs.config.allowBroken = true; }
       in configuration.nix to override this.

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
         { allowBroken = true; }
       to ~/.config/nixpkgs/config.nix.

EDIT:

error if you attempt to build it:

ByteCodeLink.lookupCE
During interactive linking, GHCi couldn't find the following symbol:
  recursionzmschemeszm5zi2zi2zi1zmYW4xOyDGcg3POedRDdiKO_DataziFunctorziFoldableziTH_zdfMakeBaseFunctorNamezuzdcmakeBaseFunctor_closure
This may be due to you not asking GHCi to load extra object files,
archives or DLLs needed by your current session.  Restart GHCi, specifying
the missing library using the -L/path/to/object/dir and -lmissinglibname
flags, or simply by naming the relevant files on the GHCi command line.
Alternatively, this link failure might indicate a bug in GHCi.
If you suspect the latter, please report this as a GHC bug:
  https://www.haskell.org/ghc/reportabug