[larluo@larluo-nixos:~]$ uname -a
Linux larluo-nixos 4.14.52 #1-NixOS SMP Tue Jun 26 00:06:33 UTC 2018 x86_64 GNU/Linux
[larluo@larluo-nixos:~]$ ls -l $(which stack)
lrwxrwxrwx 1 root root 65 Jan 1 1970 /home/larluo/.nix-profile/bin/stack -> /nix/store/4s5l0p1s906prwsapm2g083cp5z4haxl-stack-1.6.5/bin/stack
[larluo@larluo-nixos:~]$ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-unstable
[larluo@larluo-nixos:~]$ stack --nix repl
error: attribute 'ghc843' missing, at (string):1:43
(use '--show-trace' to show detailed location information)
[larluo@larluo-nixos:~]$ nix-env -f "<nixpkgs>" -qaP -A haskell.compiler.ghc843
error: attribute 'ghc843' in selection path 'haskell.compiler.ghc843' not found
[larluo@larluo-nixos:~]$ nix-instantiate --eval -E "with import <nixpkgs> {}; lib.attrNames haskell.compiler"
[ "ghc704" "ghc704Binary" "ghc7103" "ghc7103Binary" "ghc742" "ghc742Binary" "ghc763" "ghc784" "ghc784Binary" "ghc802" "ghc821Binary" "ghc822" "ghc841" "ghcHEAD" "ghcjs" "ghcjsHEAD" "integer-simple" ]
You'll have to update your channel. ghc843 has been added to the package set on Wed May 30 00:37:47 2018 +0200.
why didn't it take affect after i update the channel?
[larluo@larluo-nixos:~/work/git/larluo-env]$ nix-env -iA nixpkgs.haskell.compiler.ghc843
replacing old 'ghc-8.4.3'
installing 'ghc-8.4.3'
building '/nix/store/ci7y91w4yagjgjxls95f2j4a4d9zypnx-user-environment.drv'...
created 6772 symlinks in user environment
[larluo@larluo-nixos:~/work/git/larluo-env]$ stack --nix repl
error: attribute 'ghc843' missing, at (string):1:43
(use '--show-trace' to show detailed location information)
[larluo@larluo-nixos:~/work/git/larluo-env]$ nix-instantiate --eval -E "with import <nixpkgs> {}; lib.attrNames haskell.compiler"
[ "ghc704" "ghc704Binary" "ghc7103" "ghc7103Binary" "ghc742" "ghc742Binary" "ghc763" "ghc784" "ghc784Binary" "ghc802" "ghc821Binary" "ghc822" "ghc841" "ghcHEAD" "ghcjs" "ghcjsHEAD" "integer-simple" ]
nix-env uses the package set found in ~/.nix-defexpr whereas stack and nix-instantiate use whatever the environment variable $NIX_PATH points to. Maybe those two aren't aligned?
it seems NIX_PATH use the root channel.
how to resolve it?
[larluo@larluo-nixos:~/larry-tmp/my-nixops]$ ls -l ~/.nix-defexpr
total 0
lrwxrwxrwx 1 larluo users 46 Jul 16 21:35 channels -> /nix/var/nix/profiles/per-user/larluo/channels
lrwxrwxrwx 1 larluo users 44 Jul 3 23:10 channels_root -> /nix/var/nix/profiles/per-user/root/channels
[larluo@larluo-nixos:~/larry-tmp/my-nixops]$ echo $NIX_PATH
nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels
thanks.
i update the root's channel, now then it's ok.
Most helpful comment
thanks.
i update the root's channel, now then it's ok.