-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nix-shell fails when passed -A env
#19
Comments
After further investigation, cloning this repo and running the command works. I had created my own repo and was following the README when I got the error above. There must be something that I'm missing but my default.nix looks identical to the one in this repo. Where is |
The $ nix-shell --attr foo someFile.nix ... it is the same as: $ nix-shell --expr '(import someFile.nix).foo` In other words, it imports that file, evaluates the corresponding Nix expression, and then assumes that it is a record and tries to access the The reason that let
pkgs = import <nixpkgs> { };
in
pkgs.haskellPackages.callPackage ./default.nix { } ... and every Haskell package derivation has an let
pkgs = import <nixpkgs> { };
in
{ project0 = pkgs.haskellPackages.callPackage ./default.nix { };
} ... which is why the attribute changes to So the reason Also, |
I've read through the Nix docs and other posts online and that was the most concise explanation I've seen for how the different parts of the command come together, thank you!
Ahhh, that's the missing piece! Reading back through it again I can see two things that initially confused me:
Also, all Haskell packages have In any case, I think having a section about how Haskell package derivations are structured and how the attribute argument is combined with the Nix expression would be very useful somewhere in this repo. Anyways, thanks again for putting this together! It was incredibly helpful and I think I'm going to use Nix going forward :) |
Not all packages have a I will probably stick with not wrapping the result in a record initially, but better explain what the |
I have a pull request out with updates to the tutorial: #22 Take a look at that and let me know if that addresses your initial confusion |
Left a few comments but LGTM. |
On the most recent version of Nix the
nix-shell -A env release0.nix
command fails with the error:Version info:
nix-shell --version
If you omit the
-A env
it works as expected.The text was updated successfully, but these errors were encountered: