In my NixOS machine, I can use nix-env to query about the ghc package in two ways:
One is nix-env -f '<nixpkgs>' -qaP ghc which results in the output
ghc ghc-8.6.5
Another is nix-env -qaP ghc which results in the output
nixpkgs.ghc ghc-8.6.5
For the second case, I would like to understand why the active Nix expression has a nixpkgs root attribute.
The contents of the ~/.nix-defexpr folder and several subfolders are the following:
How is the active Nix expression assembled from the contents of ~/.nix-defexpr? Why there isn't a channels root attribute? Does the name of the nixpkgs root attribute derive from the name of the nixpkgs folder, or is it derived from the contents of the folder, perhaps from something declared in the default.nix file?
