Nix repl not using registry nixpkgs?

Hello all,

I can do this and I enter a shell with ghc 963 available:

$ nix shell nixpkgs#haskell.compiler.ghc963

But if I do this:

$ nix repl --expr "with (import <nixpkgs> {}); haskell.compiler.ghc963"

then I get an error:

       error: attribute 'ghc963' missing

       at «string»:1:29:

            1| with (import <nixpkgs> {}); haskell.compiler.ghc963
             |                             ^
       Did you mean ghc901?

I’d assume that for both of these, nixpkgs would resolve to the nixpkgs I have in my nix registry, which should be github:NixOS/nixpkgs/nixos-unstable. Am I missing something (and, evidently I am).

I believe import <nixpkgs> loads nixpkgs from channels, see “modulesPath” from wiki. Channels are tangentially related to the flake registry and don’t update the same way.

If you want to get the same Nixpkgs in an expression that your flaky commands use, you can use builtins.getFlake instead of angle brackets.

Yes, thank you, you’re right. I had nixpkgs set in my NIX_PATH.